How to best fit a curve to my data
6 ビュー (過去 30 日間)
古いコメントを表示
Hi, I have 2 variables (attached in the file myXY.mat) to which I would like to fit a curve.
I'm expecting to receive something like this (the pic is manually drawn):
Here's my code:
f = fit(X,Y,'exp1')
plot(f,X,Y)
And here's what I get:
Any ideas what the code should be to receive a fit more similar to what I drew?
2 件のコメント
採用された回答
その他の回答 (1 件)
Rik
2017 年 12 月 5 日
You need to change the starting guesses and you might have to adjust the function itself.
x=0:0.01:10;
y=1-exp(-x);
plot(x,y)
The code above will result in a similar shape of what you are asking. 'exp1' will support this, except for the offset. You can provide your own function instead by using the anonymous function input.
PS you need to make sure that for your application, it is indeed an exponential function and not a (square) root.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Curve Fitting Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!