Finding more than one root for nonlinear equation

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:
I'm trying to solve for qb, qt, beta, and their respective derivatives.

7 Comments

What is A ? How to get a scalar from -A^(-1)*[1;0;0] ?
You could try setting it all up using the Symbolic toolbox, and solve()
A is another Matrix! But doesnt solve only return one possível answer?
I don't understand how an inverse of a matrix can be a vector of size 1x3 which is necessary to make
-A^(-1)*[1;0;0] a scalar.
That's true, I sent It wrong. Its going to be a 1x3 vector, and the rest of the Matrix madre of zero.
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.
Thank you both so much! Im going to try It right away!

Sign in to comment.

Answers (1)

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])
sol = struct with fields:
q_b: [3x1 sym] q_t: [3x1 sym] beta: [3x1 sym] q_dot_b: [3x1 sym]
char(sol.q_b)
ans = '[0; (((a41^3*(a52*a63 - a53*a62)^3)/(a11*(a42*a53*a64 - a42*a54*a63 - a43*a52*a64 + a43*a54*a62 + a44*a52*a63 - a44*a53*a62)^3))^(1/2)*(a42*a53*a64 - a42*a54*a63 - a43*a52*a64 + a43*a54*a62 + a44*a52*a63 - a44*a53*a62))/(a41*(a52*a63 - a53*a62)); -(((a41^3*(a52*a63 - a53*a62)^3)/(a11*(a42*a53*a64 - a42*a54*a63 - a43*a52*a64 + a43*a54*a62 + a44*a52*a63 - a44*a53*a62)^3))^(1/2)*(a42*a53*a64 - a42*a54*a63 - a43*a52*a64 + a43*a54*a62 + a44*a52*a63 - a44*a53*a62))/(a41*(a52*a63 - a53*a62))]'
char(sol.q_t)
ans = '[0; -((a53*a64 - a54*a63)*((a41^3*(a52*a63 - a53*a62)^3)/(a11*(a42*a53*a64 - a42*a54*a63 - a43*a52*a64 + a43*a54*a62 + a44*a52*a63 - a44*a53*a62)^3))^(1/2))/(a52*a63 - a53*a62); ((a53*a64 - a54*a63)*((a41^3*(a52*a63 - a53*a62)^3)/(a11*(a42*a53*a64 - a42*a54*a63 - a43*a52*a64 + a43*a54*a62 + a44*a52*a63 - a44*a53*a62)^3))^(1/2))/(a52*a63 - a53*a62)]'
char(sol.beta)
ans = '[0; ((a52*a64 - a54*a62)*((a41^3*(a52*a63 - a53*a62)^3)/(a11*(a42*a53*a64 - a42*a54*a63 - a43*a52*a64 + a43*a54*a62 + a44*a52*a63 - a44*a53*a62)^3))^(1/2))/(a52*a63 - a53*a62); -((a52*a64 - a54*a62)*((a41^3*(a52*a63 - a53*a62)^3)/(a11*(a42*a53*a64 - a42*a54*a63 - a43*a52*a64 + a43*a54*a62 + a44*a52*a63 - a44*a53*a62)^3))^(1/2))/(a52*a63 - a53*a62)]'
char(sol.q_dot_b)
ans = '[0; -((a41^3*(a52*a63 - a53*a62)^3)/(a11*(a42*a53*a64 - a42*a54*a63 - a43*a52*a64 + a43*a54*a62 + a44*a52*a63 - a44*a53*a62)^3))^(1/2); ((a41^3*(a52*a63 - a53*a62)^3)/(a11*(a42*a53*a64 - a42*a54*a63 - a43*a52*a64 + a43*a54*a62 + a44*a52*a63 - a44*a53*a62)^3))^(1/2)]'

Products

Release

R2022a

Asked:

on 10 Dec 2024

Edited:

on 10 Dec 2024

Community Treasure Hunt

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

Start Hunting!