10 views (last 30 days)
Mepe on 20 Feb 2020
Commented: Mepe on 20 Feb 2020
So far I have solved the equation below with fsolve (with the help of this forum).
tau = 0.1
f4 = [3; 2; 6; 8]
f8 = [2; 6; 7; 3]
eq = @(s,f4,f8) s*tau-(0.1.*s^2+3.54.*s-9.53).*f4.^2-f8;
for f = 1:1:length (f4)
F1 (f,:) = fsolve (@(s)eq(s,f4(f),f8(f)), 0);
end
Unfortunately, only a solution of the quadratic equation is given here. I didn't get along with the command roots () because my "formulas" were not accepted here. Does anyone have an idea here how elegantly all solutions can be found?

Alex Mcaulley on 20 Feb 2020
Edited: Alex Mcaulley on 20 Feb 2020
To use the function roots you need to reformulate your equation:
tau = 0.1
f4 = [3; 2; 6; 8]
f8 = [2; 6; 7; 3]
eq = @(f4,f8) [-0.1*f4^2, -3.54*f4^2 + tau,9.53*f4^2-f8];
sol = zeros(numel(f4),2);
for f = 1:1:length(f4)
sol(f,:) = roots(eq(f4(f),f8(f)));
end
>> sol
sol =
-37.7542 2.4654
-37.3027 2.1527
-37.8394 2.4672
-37.8874 2.5030
Mepe on 20 Feb 2020
Works perfect. Thanks!

### Categories

Find more on Systems of Nonlinear Equations in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by