Solving an equation with more than one unknown in matlab

조회 수: 1 (최근 30일)
mandy
mandy 2015년 3월 24일
답변: Star Strider 2015년 3월 24일
I am trying to find the solutions to the following two equations but since Matlab reads line to line I don't know how to enter these two equations so that it understands what I am trying to input. My code is
a=((-u/(10*j))+(s/(100*-j)))/((1/(j*100))-(1/10)-(1/10*j))
u=(((a/(10*j))-10)/(((1/100*j))+(1/10*j)))
s=25*exp(j*30*pi/180);

답변 (1개)

Star Strider
Star Strider 2015년 3월 24일
If you have the Symbolic Math Toolbox:
syms a u s
eqn1 = a==((-u/(10*j))+(s/(100*-j)))/((1/(j*100))-(1/10)-(1/10*j));
eqn2 = u==(((a/(10*j))-10)/(((1/100*j))+(1/10*j)));
eqn1 = subs(eqn1, {u}, {(((a/(10*j))-10)/(((1/100*j))+(1/10*j)))});
eqns = subs(eqn1, {s}, {25*exp(j*30*pi/180)});
a = vpasolve(eqns, a)
u = vpa(subs((((a/(10*j))-10)/(((1/100*j))+(1/10*j))),{a},{a}))
produces:
a =
88.519552132457129958929869921769 - 19.064250734748366881795919457402i
u =
- 80.472320120415572689936245383426 + 108.24022794068033352890538132491i
Could be more efficient, but this is the end of my day and I’m tired.

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by