Solving an equation with more than one unknown in matlab

1 次查看(过去 30 天)
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