필터 지우기
필터 지우기

Why I am getting empty sym for vpasolve?

조회 수: 1 (최근 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 CenterFile Exchange에서 Function Creation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by