Why I am getting empty sym for vpasolve?

2 ビュー (過去 30 日間)
safisay
safisay 2017 年 12 月 4 日
コメント済み: safisay 2017 年 12 月 5 日
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?

採用された回答

Nicolas Schmit
Nicolas Schmit 2017 年 12 月 4 日
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 件のコメント
Walter Roberson
Walter Roberson 2017 年 12 月 5 日
I suspect you have a sol in memory that is a structure or object.
safisay
safisay 2017 年 12 月 5 日
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.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFunction Creation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by