Hello I'm writing a code that expands a summation and I'm doing it in a for loop. This is for a much more complicated problem that I'm doing but I want to check it. My code seems to "work" in the bigger problem but It's giving me different results than when put the expanded summations. I'm trying to check the loop in a different file but It's not working.
This is what I have in the other file.
syms y1 y2 y3 y4
y=[y1 y2 y3 y4];
g = zeros(3,3,3,3);
for m = 0:2
for i = 0:2
for j = 0:2
for k = 0:2
g(m+1,i+1,j+1,k+1) = integral(@(z)Modeshape2t(m,i,j,k,z),0,1);
A(m,i) = A(m,i) -2*y(j*2-1,:)*g(m+1,i+1,j+1,0+1);
A(m,i) = A(m,i) + y(j*2-1,:).*y(k*2-1,:)*g(m+1,i+1,j+1,k+1);
This is the error text I get:
*The following error occurred converting from sym to double: Error using mupadmex Error in MuPAD command: 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 Untitled (line 27) A(m,i) = A(m,i) -2*y(j*2-1,:)*g(m+1,i+1,j+1,0+1);*
I don't know what that means or how to fix it. I just want to see if I get the whole expanded functions I want.