I would like to define a vector,X, with five elements:
syms aX = zeros(1,5);X(1) = 1;for k = 1:4 X(k+1)=X(k)+a^2;end
Actually I need to have the vector X, that its elements should be based on variable a. But I face an error in MATLAB:
The following error occurred converting from sym to double:Error using symengine (line 58)DOUBLE cannot convert the input expression into a double array.If the input expression contains a symbolic variable, use VPA.Error in Code2 (line 5)X(k+1)=X(k)*a^2;
when I write the code above. How to do this? Please Answer me if possible.
Best Answer