Search All of the Math Forum:

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

Topic: symbolic in FOR loop. not run...WHy??
Replies: 1   Last Post: Dec 31, 2012 12:48 AM

 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

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

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!

Date Subject Author
12/21/12 Quynh Tram Nghuyen Thi
12/31/12 Steven Lord