Solving an equation with more than one unknown in matlab

1 visualización (últimos 30 días)
mandy
mandy el 24 de Mzo. de 2015
Respondida: Star Strider el 24 de Mzo. de 2015
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);

Respuestas (1)

Star Strider
Star Strider el 24 de Mzo. de 2015
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.

Categorías

Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by