Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: spdiags() “Index exceeds matrix dimensions.”ask for help??
Replies: 1   Last Post: Nov 18, 2012 11:53 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
dfd ssss

Posts: 2
Registered: 11/17/12
spdiags() “Index exceeds matrix dimensions.”ask for help??
Posted: Nov 18, 2012 1:34 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I just want to form a block tridiagonal matrix(DOWN is sub M in the middle,UP is sup),however, every time I used spdiags() ,it gave me a message ?Index exceeds matrix dimensions.?,I don't know why and I'm a beginner of matlab,hopefully, someone can give me a hand,thank you very much!

M = cell(1,NT-1);

for i = 1:NT-1

M{i} = [(1+(detT/(5*detX*detX))-detT+2*detT*u(i)+4*detT*v(i))-1,(4*detT*u(i))-1;(-4*detT*v(i))-1,(1+2*detT/(detX*detX)+0.25*detT-4*detT*u(i)+5*detT*lm*exp(-5*v(i)))-1];

end
LK = cell(1,NT-1);
for i = 1:NT-2
LK{i}=[1,1;1,1];
end



UP = cell(1,NT-1);
for i = 1:NT-1

UP{i} =[-detT/(10*detX*detX),0;0,-detT/(detX*detX)];

end

DOWN=cell(1,NT-1);
for i = 1:NT-2

DOWN{i} =[-detT/(10*detX*detX),0;0,-detT/(detX*detX)];

end
A = spdiags([DOWN M UP],-1:1,NT-1,NT-1);



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.