Effacer les filtres
Effacer les filtres

Why I am getting empty sym for vpasolve?

1 vue (au cours des 30 derniers jours)
safisay
safisay le 4 Déc 2017
Commenté : safisay le 5 Déc 2017
Hi all,
this is my code
syms theta1 theta2 gama M l
eqn = theta1 == 2*atan((2*tan(theta2/2)*tan(gama/2 - theta2/2) + (4*tan(theta2/2)^2 - 4*M^2*tan(theta2/2)^2 - 4*M^2*tan(gama/2 - theta2/2)^2 - M^2*gama^2*l^2 - 8*M^2*tan(theta2/2)*tan(gama/2 - theta2/2) - 4*M^2*gama*l*tan(theta2/2) - 4*M^2*gama*l*tan(gama/2 - theta2/2) - M^2*gama^2*l^2*tan(theta2/2)^2*tan(gama/2 - theta2/2)^2 + 2*M^2*gama^2*l^2*tan(theta2/2)*tan(gama/2 - theta2/2) + 4*M^2*gama*l*tan(theta2/2)*tan(gama/2 - theta2/2)^2 + 4*M^2*gama*l*tan(theta2/2)^2*tan(gama/2 - theta2/2) + 4)^(1/2) - 2)/(2*tan(theta2/2) + 2*M*tan(gama/2 - theta2/2) + 2*M*tan(theta2/2) + M*gama*l - M*gama*l*tan(theta2/2)*tan(gama/2 - theta2/2)) - (2*tan(theta2/2)*tan(gama/2 - theta2/2))/(2*tan(theta2/2) + 2*M*tan(gama/2 - theta2/2) + 2*M*tan(theta2/2) + M*gama*l - M*gama*l*tan(theta2/2)*tan(gama/2 - theta2/2)));
F=1.06;
gama=pi/F;
thetac=0:0.2:gama;
theta2=thetac;
l=0.2181818;
M=0.960615;
seqn = subs(eqn);
sol = vpasolve(seqn)
alpha_1=theta1/thetac;
plot(thetac,alpha_1)
When I am trying to find solutions for theta1, it is giving me empty sym.
Can anyone help me regarding this?

Réponse acceptée

Nicolas Schmit
Nicolas Schmit le 4 Déc 2017
Since thetac is an array of 15 elements, you are trying to solve a system of 15 incompatible equations, therefore, there is no answer. You should solve the equation for each value of thetac.
syms theta1 theta2 gama M l
eqn = theta1 == 2*atan((2*tan(theta2/2)*tan(gama/2 - theta2/2) + (4*tan(theta2/2)^2 - 4*M^2*tan(theta2/2)^2 - 4*M^2*tan(gama/2 - theta2/2)^2 - M^2*gama^2*l^2 - 8*M^2*tan(theta2/2)*tan(gama/2 - theta2/2) - 4*M^2*gama*l*tan(theta2/2) - 4*M^2*gama*l*tan(gama/2 - theta2/2) - M^2*gama^2*l^2*tan(theta2/2)^2*tan(gama/2 - theta2/2)^2 + 2*M^2*gama^2*l^2*tan(theta2/2)*tan(gama/2 - theta2/2) + 4*M^2*gama*l*tan(theta2/2)*tan(gama/2 - theta2/2)^2 + 4*M^2*gama*l*tan(theta2/2)^2*tan(gama/2 - theta2/2) + 4)^(1/2) - 2)/(2*tan(theta2/2) + 2*M*tan(gama/2 - theta2/2) + 2*M*tan(theta2/2) + M*gama*l - M*gama*l*tan(theta2/2)*tan(gama/2 - theta2/2)) - (2*tan(theta2/2)*tan(gama/2 - theta2/2))/(2*tan(theta2/2) + 2*M*tan(gama/2 - theta2/2) + 2*M*tan(theta2/2) + M*gama*l - M*gama*l*tan(theta2/2)*tan(gama/2 - theta2/2)));
F=1.06;
gama=pi/F;
thetac=0:0.2:gama;
l=0.2181818;
M=0.960615;
for k=1:numel(thetac)
theta2=thetac(k);
seqn = subs(eqn);
sol(k) = vpasolve(seqn)
end
alpha_1=sol./thetac;
plot(thetac,alpha_1)
  4 commentaires
Walter Roberson
Walter Roberson le 5 Déc 2017
I suspect you have a sol in memory that is a structure or object.
safisay
safisay le 5 Déc 2017
I have somehow solved it. The problem was I tried to put two two sets of these type of equations. that's why may be this problem arises.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Function Creation dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by