필터 지우기
필터 지우기

Solution of system of linear equation

조회 수: 1 (최근 30일)
Barkat
Barkat 2018년 5월 20일
댓글: Barkat 2018년 5월 20일
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
John D'Errico
John D'Errico 2018년 5월 20일
편집: John D'Errico 2018년 5월 20일
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

댓글을 달려면 로그인하십시오.

답변 (1개)

John D'Errico
John D'Errico 2018년 5월 20일
편집: John D'Errico 2018년 5월 20일
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
John D'Errico
John D'Errico 2018년 5월 20일
More importantly, do you understand why an error arose?
Barkat
Barkat 2018년 5월 20일
Yes Sir, But instead of using % code endvars = [V alpha theta]; [solv, solu] = solve(eqns, vars) How can I correct the response?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Equation Solving에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by