numerical solution of equation
2 views (last 30 days)
Show older comments
safi58
on 20 Feb 2017
Commented: Walter Roberson
on 15 Mar 2017
syms m_c_theta1 m_c0 M theta1 j_L0 j_L_theta1 l
syms m_c_gama k1 gama j_L_gama
j_L_theta1=1.5;
theta1=120;
k1=0.423;
gama=180;
m_c_gama=0.9;
j_L_gama=0.3;
l=0.218;
eqn1=m_c_theta1==(m_c0-1/M+1)*cos(theta1)+j_L0*sin(theta1)+1/M-1;
eqn2=j_L_theta1==(-m_c0+1/M-1)*sin(theta1)+j_L0*cos(theta1);
%eqn3=m_m_theta1==1;
%eqn3=j_Lm_theta1==j_Lm0+l*theta1;
%eqn4=m_c_theta2==j_L_theta1*sin(theta2-theta1)+(m_c_theta1+1)*cos(theta2-theta1)-1;
%eqn5=j_L_theta2==j_L_theta1*cos(theta2-theta1)-(m_c_theta1+1)*sin(theta2-theta1);
%m_m_theta2=1;
%qn6=j_Lm_theta2==j_Lm0+l*theta2;
eqn7=m_c_gama==(1/k1)*j_L_theta1*sin(k1*((gama-theta1)*(pi/180))*(180/pi))+m_c_theta1*cos(k1*((gama-theta1)*(pi/180))*(180/pi));
eqn8=j_L_gama==j_L_theta1*cos(k1*((gama-theta1)*(pi/180))*(180/pi))-k1*m_c_theta1*sin(k1*((gama-theta1)*(pi/180))*(180/pi));
%eqn9=j_Lm_gama==j_L_gama;
%m_m_gama=(-m_c_theta2*cos(k1*(gama-theta2))-(1/k1)*j_L_theta2*sin(k1*(gama-theta2)))/(1+l)
m_c_gama=-m_c0;
j_L_gama=-j_L0;
j_L_theta1=(theta1*(pi/180)*l)/2;
j_L_gama=j_L_theta1-l*(gama-theta1)*(pi/180);
%j_L_theta2=j_Lm_theta2;
%j_Lm0=-j_Lm_gama;
%j_L_gama=j_Lm_gama;
eqns = subs([eqn1, eqn2, eqn7, eqn8]);
sol = vpasolve(eqns, m_c0, j_L0, m_c_theta1,M)
Hi all I want solve these equations numerically and I have given all the values required. but it is showing something like that: % m_c0: [0x1 sym] j_L0: [0x1 sym] m_c_theta1: [0x1 sym] M: [0x1 sym]
I am not sure what is the problem. Can anyone help please?
0 Comments
Accepted Answer
Walter Roberson
on 20 Feb 2017
You have
theta1=120;
and
eqn1=m_c_theta1==(m_c0-1/M+1)*cos(theta1)+j_L0*sin(theta1)+1/M-1;
is theta1 in degrees or in radians?
Your expressions are really polluted with pi/180 and 180/pi . You should work entirely in radians and only covert to degrees if the user interface demands it.
If you do convert theta1 from degrees to radians you will still get no solution. Your four equations in eqns are not independent. If you solve the first three for m_c0, j_L0, m_c_theta1 and substitute the results into the last one, the remaining equation is independent of the final variable, M. Instead it has constants expressions on both sides, and the values on the two sides are quite different, one being 3/10 and the other being a value that is close to (but not exactly) pi/2
15 Comments
Walter Roberson
on 15 Mar 2017
Your code has
m_c_gama=Q(1.06);
j_L_gama=Q(0.196);
m_c_gama=-m_c0;
Notice you overwrite m_c_gama. Later you have
m_c0=Q(-0.39289591378964274585530032992682);
so that is where the 0.39* is coming from.
More Answers (1)
John D'Errico
on 20 Feb 2017
I recall an old phrase: "If wishes were horses, then beggars would ride."
Just wanting a solution to a set of nonlinear equations to exist does not make that so. Not all such systems of equations must have a solution. MATLAB has told you that no solution was found, although that does not ensure none exists.
2 Comments
See Also
Categories
Find more on Calculus 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!