Solving an equation for a variable

I am given the following equation,
fx =@(x) ((15*3)/(3*pi^4*70*5.29E-6))*(48*3^3*cos((pi*x)/(2*3))-(48*3^3)+(3*pi^3*3*x^2)-(pi^3*x^3));
If I wanted to find the value of x at say fx = 10, is there a shortcut to do so in MATLAB?

 Respuesta aceptada

Walter Roberson
Walter Roberson el 22 de Feb. de 2021

0 votos

The trick is to create a new function, such as fx10, that is fx(x)-10 and then do root finding (fzero, fsolve, vpasolve) on that new function.

5 comentarios

Walter Roberson
Walter Roberson el 22 de Feb. de 2021
Note: there are two roots that are close to 0, and another root closer to 8.
Raymond Elliott
Raymond Elliott el 22 de Feb. de 2021
I am trying to use the root finding methods you provided, but it is asking for at least two inputs. How do you know what to put for the second input?
Raymond Elliott
Raymond Elliott el 22 de Feb. de 2021
Oh nevermind I see now that the second input is where you put the value of the function you are trying to solve for. Thank you for your guidance!
Raymond Elliott
Raymond Elliott el 22 de Feb. de 2021
One last question, how were you able to find that there were two roots that were close to zero? Did you plot the function to see or did you do it some other way?
Walter Roberson
Walter Roberson el 23 de Feb. de 2021
The second input is a starting guess.
I used a negative starting guess and a modest positive starting guess. Afterwards I plotted to confirm.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Preguntada:

el 22 de Feb. de 2021

Comentada:

el 23 de Feb. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by