solving an equation in MATLAB

조회 수: 4 (최근 30일)
KeJoSa
KeJoSa 2012년 11월 3일
Hi,
I am trying to solve the following equation for q in MATLAB, however, I get a message saying q is not defined.
solve(z1*(K1-1)/(q*(K1-1)+1)+z2*(K2-1)/(q*(K2-1)+1)+z3*(K3-1)/(q*(K3-1)+1)==0,q)

채택된 답변

Matt Fig
Matt Fig 2012년 11월 3일
S = solve('z1*(K1-1)/(q*(K1-1)+1)+z2*(K2-1)/(q*(K2-1)+1)+z3*(K3-1)/(q*(K3-1)+1)','q')

추가 답변 (2개)

KeJoSa
KeJoSa 2012년 11월 3일
Thanks Matt!

Walter Roberson
Walter Roberson 2012년 11월 3일
No, the key is to add
syms q
before the call.
Also, as you are not using R2012a or later, you cannot use == in solve(). As you are comparing to 0 anyhow, just leave that part out:
solve(z1*(K1-1)/(q*(K1-1)+1)+z2*(K2-1)/(q*(K2-1)+1)+z3*(K3-1)/(q*(K3-1)+1),q)
  댓글 수: 1
Matt Fig
Matt Fig 2012년 11월 3일
What do you mean, 'No' Walter? The above code works fine on my system....

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by