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: symbolic in FOR loop. not run...WHy??
Replies: 1   Last Post: Dec 31, 2012 12:48 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Quynh Tram Nghuyen Thi

Posts: 37
Registered: 4/13/12
symbolic in FOR loop. not run...WHy??
Posted: Dec 21, 2012 1:24 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Helloo all,
I may put a question about symbolic & for loop. I AM USING FOR loop to construct functions as following:

(M-FILE)
syms x y
for i=1:4
N(i,1)=(x-1)*(y-1);N(i+4,1)=(x-5+i)*(y-2);
N(i,2)=-(x-i+1)*(y-1);N(i+4,2)=-(x-4+i)*(y-2);
N(i,3)=(x-i+1)*(y);N(i+4,3)=(x-4+i)*(y-1);
N(i,4)=-(x-1)*(y);N(i+4,4)=(x-5+i)*(y-1);

end
(RUNNING ERROR)
? The following error occurred converting from sym to
double:
Error using ==> sym.double at 25
DOUBLE cannot convert the input expression into a double
array.
If the input expression contains a symbolic variable, use
the VPA function instead.

Error in ==> poiosnfem_trial at 41
N(i,1)=(x-1)*(y-1);N(i+4,1)=(x-5+i)*(y-2);


WHY?? I DONT UNDERSTAND AT ALL. please, ANY IDEAS!



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.