Filter löschen
Filter löschen

Why I am getting empty sym for vpasolve?

1 Ansicht (letzte 30 Tage)
safisay
safisay am 4 Dez. 2017
Kommentiert: safisay am 5 Dez. 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?

Akzeptierte Antwort

Nicolas Schmit
Nicolas Schmit am 4 Dez. 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 Kommentare
Walter Roberson
Walter Roberson am 5 Dez. 2017
I suspect you have a sol in memory that is a structure or object.
safisay
safisay am 5 Dez. 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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Function Creation finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by