How to automate/solve this process in MATLAB
3 ビュー (過去 30 日間)
古いコメントを表示
Lets say that I have this equation in MATLAB: . I am trying to determine at what value of u will the equation yield complex solutions with the imaginary part for all those solutions being equal. For example, for this equation I gave, I know for a fact that there is at least 1 soution for u that makes all imaginary part of the solutions equal. I am so tired of performing this process by hand and graphing, but for the life of me cannot figure out how to make MATLAB efficiently do it.
0 件のコメント
採用された回答
Walter Roberson
2023 年 11 月 1 日
移動済み: Walter Roberson
2023 年 11 月 1 日
syms s u
eqn = 1472*s^4 - 256*s^2*u^2 + 1392*s^2 - 24*u^2 + 150 == 0
sol = solve(eqn, s, 'maxdegree', 4)
We can see by examination that and are both solutions. If had a non-zero imaginary component then would have an imaginary component that was the negative of the one for and therefore the system could not have all imaginary components equal. Likewise for which has the same situation.
Therefore for the imaginary components of the system to all be equal, the solutions must all be real-valued, and the question then becomes under what conditions and are both real-valued.
eqn2 = [sol(1)^2 > 0, sol(2)^2 > 0]
solu1 = solve(eqn2(1) + eqn2(2), u, 'returnconditions', true)
solu1.u
solu1.conditions
vpa(solu1.conditions)
solu2 = solve(eqn2(1) - eqn2(2), u, 'maxdegree', 4, 'returnconditions', true)
solu2.u
solu2.conditions
The z < and z > bounds for solu1 and solu2 are the same -- those are simple bounds.
But is there a z (also known as u) such that 256*z^4 - 2232*z^2 + 4119 is real and negative?
syms z real
rr = 256*z^4 - 2232*z^2 + 4119
solz = solve(rr, 'real', true, 'maxdegree', 4)
vpa(solz)
If we compare the second of those results, 2.46-ish to the simple bound for u, about 2.33-ish, then we can deduce that there might be
u2 = vpasolve(children(solu2.conditions, 1), solz(2))
backcheck1 = subs(solu2, solu2.parameters, u2)
simplify(backcheck1.conditions)
backcheck2 = subs(solu2, solu2.parameters, u2-1/100)
simplify(backcheck2.conditions)
backcheck3 = subs(solu2, solu2.parameters, u2+1/100)
simplify(backcheck3.conditions)
u3 = solz(2);
backcheck4 = subs(solu2, solu2.parameters, u3)
simplify(backcheck4.conditions)
backcheck5 = subs(solu2, solu2.parameters, u3-1/100)
simplify(backcheck5.conditions)
backcheck6 = subs(solu2, solu2.parameters, u3+1/100)
simplify(backcheck6.conditions)
So the actual bounds are +/- solz(2) -- that outside that range, the imaginary components of eqn should all be 0 and so should all be equal as required.
0 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!