# How to automate/solve this process in MATLAB

3 views (last 30 days)

Show older comments

Ali Almakhmari
on 1 Nov 2023

Moved: Walter Roberson
on 1 Nov 2023

##### 0 Comments

### Accepted Answer

Walter Roberson
on 1 Nov 2023

Moved: Walter Roberson
on 1 Nov 2023

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 Comments

### More Answers (0)

### See Also

### Categories

### Community Treasure Hunt

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

Start Hunting!