Reputation: 113
In the M-file "matrixT.m", i wrote the function matrixT to generate a n*3 matrix like that
function T=matrixT(alpha,n)
T=zeros(3,n);
for i=1:n
T(1,i)=cos(alpha(i));
T(2,i)=sin(alpha(i));
T(3,i)=sin(alpha(i)-i*pi/2);
end
Then i use it in my main M-file
alpha=sym('alpha');
V=subs(hessian(det(matrixT(alpha,3)),alpha),alpha,alpha0);
but there are many error. Can you help me to fix this?
Upvotes: 1
Views: 7020
Reputation: 15986
I believe your problem lies in the assignment: T(1,i)=cos(alpha(i));
. You have assigned alpha
to be a symbolic variable, but then you try to assign it to an array of doubles and MATLAB complains. Is it possible to evaluate the value of alpha
before attempting to place it inside the array T
?
Upvotes: 3