Solution of system of linear equation

3 visualizaciones (últimos 30 días)
Barkat
Barkat el 20 de Mayo de 2018
Comentada: Barkat el 20 de Mayo de 2018
Dear All I need to solve the system of linear equations. I have 5 variables [t0 rp V theta alpha]. I need to calculate V, theta, alpha from the following three equations at different known values of t0 and rp using solve command but the following message appears. Note : the first guess for t0=20e-3;rp=0.2e-2. "Error using solve (line 278) Input with 3 variables and output with 2 variables are inconsistent."
a = 0.45611;b1= 17.03;
q1 = 0.062988; q2 = 18.68;
c1 = 0.0026617;c2= -0.9238;
g=9.81; S=0.012;ro=1000;mw=5;rw=0.2e-3;m_bar=0.8;
syms V alpha theta
d1 =((1/2)*ro*V^2)*S*(a + b1*alpha^2);
Q = ((1/2)*ro*V^2)*S*(q1+q2*alpha);
T = ((1/2)*ro*V^2)*S*(c1 + c2*alpha);
eqn1 = -t0*g*sin(theta)+Q*alpha-d1 == 0;
eqn2 = t0*g*cos(theta)-Q-d1*alpha == 0;
eqn3 = T-m_bar*g*rp*cos(theta)==0;
eqns=[eqn1 eqn1 eqn3]
vars = [V alpha theta];
[solv, solu] = solve(eqns, vars)
  1 comentario
John D'Errico
John D'Errico el 20 de Mayo de 2018
Editada: John D'Errico el 20 de Mayo de 2018
Please learn to format your code next time to be readable.
https://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup#answer_18099

Iniciar sesión para comentar.

Respuestas (1)

John D'Errico
John D'Errico el 20 de Mayo de 2018
Editada: John D'Errico el 20 de Mayo de 2018
First, why do you think this is a system of LINEAR equations?
theta is one of your unknowns. The presence of sin(theta) and cos(theta) would be enough to make that false. Then we have alpha and V. They appear in various forms, thus alpha, alpha^2, and V^2, and as a product of the two.
This is a system of NONLINEAR equations. The mere presence of an addition sign does not make them linear.
The error return is simple to understand. You have THREE unknowns, thus V, alpha, theta. You have TWO outputs: solv and solu. You provide no place to return THREE results. When called with one output, solve is smart enough to stuff the results as fields of a struct. But when you ask for three outputs and provide two containers it gets confused, and rightfully so.
  3 comentarios
John D'Errico
John D'Errico el 20 de Mayo de 2018
More importantly, do you understand why an error arose?
Barkat
Barkat el 20 de Mayo de 2018
Yes Sir, But instead of using % code endvars = [V alpha theta]; [solv, solu] = solve(eqns, vars) How can I correct the response?

Iniciar sesión para comentar.

Categorías

Más información sobre Systems of Nonlinear Equations en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by