How to find x value for a given y?

20 vues (au cours des 30 derniers jours)
Yago Molano Gomez
Yago Molano Gomez le 8 Avr 2020
I am trying to find the x value for a specific y value, from a fit. My first guess into how to solve this was:
xval = fzero([cfit - y], x0);
However this does not work as cfit do not recognize the - sign.
Is there a way to alter the coefficients of the fit I have? Alternatively, is there a simpler function that can be used?
Thanks in advance.

Réponses (1)

darova
darova le 8 Avr 2020
Here is an example:
f = @(x) sin(x);
x = 0:10;
x0 = fzero(@(x)f(x)-0.5,pi);
plot(x0,f(x0),'or')
line(x,f(x))
If you have more parameters use thi
x0 = fzero(@(x)f(a,b,x)-0.5, pi);

Catégories

En savoir plus sur Fit Postprocessing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by