Solve two equations for one variable
1 次查看(过去 30 天)
显示 更早的评论
Hello everyone!
I am having problems to solve a simple system of two equations for a single variable. The equations look like:

It is possible to analytically calculate the solution for
through the following steps:
- Isolate
in the second equation and replace it in the first equation:

- Then using the fact that


- Then, isolating
:
- Finally:

Using MATLAB Symbolic Toolbox, I wrote the following piece of code in order to find the same analytical solution:
syms P_st vdq_st_abs Vabs delta_st Vangle Xg Q_st
eq1 = P_st - vdq_st_abs * Vabs * sin(delta_st - Vangle) / Xg == 0;
eq2 = (Q_st * Xg - Vabs^2)/(Vabs * cos(delta_st - Vangle)) - vdq_st_abs == 0;
eqs = [eq1; eq2];
sol = solve(eqs, delta_st);
disp(sol)
However, the output is parameterized, and I do not understand it very well. Could someone explain me this parametrization? Also, why can't MATLAB output the same analytical solution I just mentioned?
Thank you very much in advance!
0 个评论
回答(1 个)
Torsten
2023-7-18
syms P_st vdq_st_abs Vabs delta_st Vangle Xg Q_st real
eq1 = P_st - vdq_st_abs * Vabs * sin(delta_st - Vangle) / Xg == 0;
eq2 = (Q_st * Xg - Vabs^2)/(Vabs * cos(delta_st - Vangle)) == vdq_st_abs;
eqn = lhs(eq1) * lhs(eq2) == 0;
sol = solve(eqn,delta_st,'ReturnConditions',1)
sol.delta_st
sol.conditions
4 个评论
Torsten
2023-7-19
My guess is this is what you want:
syms P_st vdq_st_abs Vabs delta_st Vangle Xg Q_st real
eq1 = P_st - vdq_st_abs * Vabs * sin(delta_st - Vangle) / Xg == 0;
eq2 = (Q_st * Xg - Vabs^2)/(Vabs * cos(delta_st - Vangle)) == vdq_st_abs;
S = solve([eq1,eq2],[delta_st,vdq_st_abs])
simplify(S.delta_st(1))
simplify(S.delta_st(2))
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




