Finding more than one root for nonlinear equation
7 views (last 30 days)
Show older comments
Hello there! Hope you're all fairing well.
I used the fsolve function to solve my problem, but it only returns one answer. I want to know if there is another function that can return all the possible answer, if there are more than one. Heres what I am trying to solve:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1820564/image.png)
I'm trying to solve for qb, qt, beta, and their respective derivatives.
7 Comments
Torsten
on 10 Dec 2024
Edited: Torsten
on 10 Dec 2024
But doesnt solve only return one possível answer?
"solve" tries to find all solutions to a system of equations.
When setting up the system using the Symbolic Toolbox as suggested by @Walter Roberson, you can already assume that q_t_dot and beta_dot are 0. This follows from equations (2) and (3) of your system.
Answers (1)
Torsten
on 10 Dec 2024
Edited: Torsten
on 10 Dec 2024
Equations (5) and (6) are two linear equations in q_t, beta and q_dot_b. Use them to express q_t and beta as linear functions of q_b_dot.
Now insert the expressions for q_t and beta in equation (4). After having done this, equations (1) and (4) will be of the form
a11*q_dot_b + a12*q_b^3 = 0
a21*q_dot_b + a22*q_b = 0
Eliminating q_dot_b gives a cubic equation for q_b that usually has 3 solutions.
Inserting backwards gives 3 solutions for all unknowns except for q_dot_t and beta_dot that were identified to be zero right at the beginning.
syms q_dot_b q_b q_t beta
syms a11 a41 a42 a43 a44 a52 a53 a54 a62 a63 a64 real
eqn1 = a11*q_b^3 + q_dot_b == 0
eqn2 = a41*q_b+a42*q_t + a43*beta + a44*q_dot_b == 0
eqn3 = a52*q_t + a53*beta + a54*q_dot_b == 0
eqn4 = a62*q_t + a63*beta + a64*q_dot_b == 0
sol = solve([eqn1,eqn2,eqn3,eqn4],[q_b,q_t,beta,q_dot_b])
char(sol.q_b)
char(sol.q_t)
char(sol.beta)
char(sol.q_dot_b)
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!