Solve a system of nonlinear equations symbolically
1 view (last 30 days)
Show older comments
Aleem Andrew on 21 Oct 2020
Commented: Aleem Andrew on 22 Oct 2020
The following code is meant to solve a system of nonlinear equations.
syms do K
eq1 =(5e-5)^2 - (do)^2 == K*25*60;
eq2 = (7.5e-5)^2 - (do)^2 == K*98*60;
sol = solve(eq1,eq2);
fprintf("%s%f\n%s%f","do: ",sol.do,"K: ",sol.K)
The output is
do is correctly formatted but despite the format specficiation K is formatted incorrectly and the string "K: " is not displayed. Can someone explain why this is happening?
Walter Roberson on 21 Oct 2020
You have a polynomial system. MATLAB is finding all solutions. Your format is only expecting one solution.
More Answers (0)
Find more on Symbolic Math Toolbox 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!