How to find x value for a given y?

22 ビュー (過去 30 日間)
Yago Molano Gomez
Yago Molano Gomez 2020 年 4 月 8 日
回答済み: darova 2020 年 4 月 8 日
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.

回答 (1 件)

darova
darova 2020 年 4 月 8 日
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);

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by