How can I solve a function for x given y?

I am trying to solve the following Weibull function for x given y.
f=fit(edges, binMean, 'Weibull', 'StartPoint', [0.01, 2]);
Obviously it's easy to solve for y given x.
y=f(0.77)
But how can I do the reverse? I want to know x when y is 0.77.

 採用された回答

Matt J
Matt J 2020 年 10 月 8 日

0 投票

x=fzero(@(x) f(x)-y, 0.5 )

4 件のコメント

Kait Clark
Kait Clark 2020 年 10 月 8 日
Thanks Matt. Just tried this as
x=fzero(@(x) f(x)-0.77, 0.5 )
but it gave me 0.6332
This doesn't appear to work as the correct value is about 0.07.
Walter Roberson
Walter Roberson 2020 年 10 月 8 日
The equation curves downwards later and 0.6332 is another root.
Give a different starting guess, such as
x=fzero(@(x) f(x)-0.77, 0.1 )
Kait Clark
Kait Clark 2020 年 10 月 8 日
Ahhh makes sense! That did it! THANK YOU!
Matt J
Matt J 2020 年 10 月 8 日
Or give the interval of interest for x, e.g.,
x=fzero(@(x) f(x)-0.77, [0,0.25])

サインインしてコメントする。

その他の回答 (0 件)

質問済み:

2020 年 10 月 8 日

コメント済み:

2020 年 10 月 8 日

Community Treasure Hunt

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

Start Hunting!

Translated by