error using vpasolve-Conversion to 'sym' from 'struct' is not possible.
Show older comments
Hi all, This is my code.
syms theta1 theta0 theta2 gama M l k_1
eqn=theta1==(k_1*sin(theta0) + k_1*sin(theta1) + k_1^2*sin(k_1*(theta1 - theta2))*cos(gama - theta2) + M*k_1*sin(gama - theta2) + sin(gama - theta2)*sin(k_1*(theta1 - theta2))*sin(theta1) - M*k_1^2*sin(k_1*(theta1 - theta2)) - k_1*cos(theta0)*sin(theta1) + k_1*cos(theta1)*sin(theta0) - k_1*sin(gama - theta2)*cos(k_1*(theta1 - theta2)) - M*k_1*sin(theta1) + k_1^2*sin(gama - theta2)*sin(k_1*(theta1 - theta2))*sin(theta0) - sin(gama - theta2)*cos(theta0)*sin(k_1*(theta1 - theta2))*sin(theta1) + sin(gama - theta2)*cos(theta1)*sin(k_1*(theta1 - theta2))*sin(theta0) + M*k_1^2*cos(theta1)*sin(k_1*(theta1 - theta2)) - M*k_1^2*sin(k_1*(theta1 - theta2))*cos(gama - theta2) + k_1*sin(gama - theta2)*cos(k_1*(theta1 - theta2))*cos(theta0) + k_1*cos(k_1*(theta1 - theta2))*sin(theta0)*cos(gama - theta2) + k_1*sin(gama - theta2)*cos(k_1*(theta1 - theta2))*cos(theta1) + k_1*cos(k_1*(theta1 - theta2))*sin(theta1)*cos(gama - theta2) - M*k_1*cos(k_1*(theta1 - theta2))*sin(theta1) - k_1^2*cos(theta0)*sin(k_1*(theta1 - theta2))*cos(gama - theta2) - k_1^2*cos(theta1)*sin(k_1*(theta1 - theta2))*cos(gama - theta2) + M*k_1*sin(gama - theta2)*cos(k_1*(theta1 - theta2)) - M*k_1*sin(gama - theta2)*cos(theta1) - M*k_1*sin(theta1)*cos(gama - theta2) + M*k_1^2*cos(theta1)*sin(k_1*(theta1 - theta2))*cos(gama - theta2) - M*k_1^2*sin(gama - theta2)*sin(k_1*(theta1 - theta2))*sin(theta1) - k_1*sin(gama - theta2)*cos(k_1*(theta1 - theta2))*cos(theta0)*cos(theta1) - k_1*cos(k_1*(theta1 - theta2))*cos(theta0)*sin(theta1)*cos(gama - theta2) + k_1*cos(k_1*(theta1 - theta2))*cos(theta1)*sin(theta0)*cos(gama - theta2) - k_1*sin(gama - theta2)*cos(k_1*(theta1 - theta2))*sin(theta0)*sin(theta1) + k_1^2*cos(theta0)*cos(theta1)*sin(k_1*(theta1 - theta2))*cos(gama - theta2) - M*k_1*sin(gama - theta2)*cos(k_1*(theta1 - theta2))*cos(theta1) - M*k_1*cos(k_1*(theta1 - theta2))*sin(theta1)*cos(gama - theta2) + k_1^2*sin(k_1*(theta1 - theta2))*sin(theta0)*sin(theta1)*cos(gama - theta2))/(M*l*(2*k_1 + sin(gama - theta2)*cos(theta1)*sin(k_1*(theta1 - theta2)) + sin(k_1*(theta1 - theta2))*sin(theta1)*cos(gama - theta2) + 2*k_1*cos(k_1*(theta1 - theta2))*cos(theta1)*cos(gama - theta2) - 2*k_1*sin(gama - theta2)*cos(k_1*(theta1 - theta2))*sin(theta1) + k_1^2*sin(gama - theta2)*cos(theta1)*sin(k_1*(theta1 - theta2)) + k_1^2*sin(k_1*(theta1 - theta2))*sin(theta1)*cos(gama - theta2)))
eqn1=theta2==-(M*k_1^2*sin(k_1*(theta1 - theta2)) - 2*k_1*sin(theta1) - k_1*sin(gama - theta2) - 2*k_1^2*sin(k_1*(theta1 - theta2))*cos(gama - theta2) - M*k_1*sin(gama - theta2) - sin(gama - theta2)*sin(k_1*(theta1 - theta2))*sin(theta1) - k_1*sin(theta0) + k_1*cos(k_1*(theta1 - theta2))*sin(theta1) + 2*k_1*cos(theta0)*sin(theta1) - 2*k_1*cos(theta1)*sin(theta0) + 2*k_1*sin(gama - theta2)*cos(k_1*(theta1 - theta2)) + k_1*sin(gama - theta2)*cos(theta0) + k_1*sin(theta0)*cos(gama - theta2) - k_1^2*cos(theta1)*sin(k_1*(theta1 - theta2)) + M*k_1*sin(theta1) - 2*k_1^2*sin(gama - theta2)*sin(k_1*(theta1 - theta2))*sin(theta0) + sin(gama - theta2)*cos(theta0)*sin(k_1*(theta1 - theta2))*sin(theta1) - sin(gama - theta2)*cos(theta1)*sin(k_1*(theta1 - theta2))*sin(theta0) - M*k_1^2*cos(theta1)*sin(k_1*(theta1 - theta2)) + M*k_1^2*sin(k_1*(theta1 - theta2))*cos(gama - theta2) - k_1*cos(k_1*(theta1 - theta2))*cos(theta0)*sin(theta1) + k_1*cos(k_1*(theta1 - theta2))*cos(theta1)*sin(theta0) - 2*k_1*sin(gama - theta2)*cos(k_1*(theta1 - theta2))*cos(theta0) - 2*k_1*cos(k_1*(theta1 - theta2))*sin(theta0)*cos(gama - theta2) - k_1*sin(gama - theta2)*cos(k_1*(theta1 - theta2))*cos(theta1) - k_1*cos(k_1*(theta1 - theta2))*sin(theta1)*cos(gama - theta2) + k_1^2*cos(theta0)*cos(theta1)*sin(k_1*(theta1 - theta2)) + M*k_1*cos(k_1*(theta1 - theta2))*sin(theta1) + k_1^2*sin(k_1*(theta1 - theta2))*sin(theta0)*sin(theta1) + 2*k_1^2*cos(theta0)*sin(k_1*(theta1 - theta2))*cos(gama - theta2) + k_1^2*cos(theta1)*sin(k_1*(theta1 - theta2))*cos(gama - theta2) - M*k_1*sin(gama - theta2)*cos(k_1*(theta1 - theta2)) + M*k_1*sin(gama - theta2)*cos(theta1) + M*k_1*sin(theta1)*cos(gama - theta2) - M*k_1^2*cos(theta1)*sin(k_1*(theta1 - theta2))*cos(gama - theta2) + M*k_1^2*sin(gama - theta2)*sin(k_1*(theta1 - theta2))*sin(theta1) + k_1*sin(gama - theta2)*cos(k_1*(theta1 - theta2))*cos(theta0)*cos(theta1) + k_1*cos(k_1*(theta1 - theta2))*cos(theta0)*sin(theta1)*cos(gama - theta2) - k_1*cos(k_1*(theta1 - theta2))*cos(theta1)*sin(theta0)*cos(gama - theta2) + k_1*sin(gama - theta2)*cos(k_1*(theta1 - theta2))*sin(theta0)*sin(theta1) - k_1^2*cos(theta0)*cos(theta1)*sin(k_1*(theta1 - theta2))*cos(gama - theta2) + M*k_1*sin(gama - theta2)*cos(k_1*(theta1 - theta2))*cos(theta1) + M*k_1*cos(k_1*(theta1 - theta2))*sin(theta1)*cos(gama - theta2) - k_1^2*sin(k_1*(theta1 - theta2))*sin(theta0)*sin(theta1)*cos(gama - theta2))/(M*l*(2*k_1 + sin(gama - theta2)*cos(theta1)*sin(k_1*(theta1 - theta2)) + sin(k_1*(theta1 - theta2))*sin(theta1)*cos(gama - theta2) + 2*k_1*cos(k_1*(theta1 - theta2))*cos(theta1)*cos(gama - theta2) - 2*k_1*sin(gama - theta2)*cos(k_1*(theta1 - theta2))*sin(theta1) + k_1^2*sin(gama - theta2)*cos(theta1)*sin(k_1*(theta1 - theta2)) + k_1^2*sin(k_1*(theta1 - theta2))*sin(theta1)*cos(gama - theta2)))
F=1.06;
gama=pi/F;
thetac=0:0.01:gama;
l=0.2181818;
k_1=0.3714;
M=0.8;
for k=1:numel(thetac)
theta0=thetac(k);
seqn = subs([eqn,eqn1]);
solv(k) = vpasolve(seqn,theta1,theta2);
sol(k)=solv.theta1
sol2(k)=solv.theta2
end
alpha_3=thetac./gama;
alpha_4=sol./gama-thetac./gama;
when running this code I am finding this error
Error using sym>tomupad (line 1175)
Conversion to 'sym' from 'struct' is not possible.
Error in sym (line 163)
S.s = tomupad(x);
Error in sym/privsubsasgn (line 982)
R = sym(R);
Error in sym/subsasgn (line 839)
C = privsubsasgn(L,R,inds{:});
Error in plot_alpha (line 85)
solv(k) = vpasolve(seqn,theta1,theta2);
Can anyone please help?
Accepted Answer
More Answers (0)
Categories
Find more on Formula Manipulation and Simplification in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!