How to find x value for a given y?
22 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
darova
on 8 Apr 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);
0 Comments
See Also
Categories
Find more on Interpolation 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!