Date: Dec 21, 2012 1:24 PM
Author: Quynh Tram Nghuyen Thi
Subject: symbolic in FOR loop. not run...WHy??
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!