exponential curve fitting with custom equation

조회 수: 14 (최근 30일)
AliHg
AliHg 2020년 4월 19일
편집: Ameer Hamza 2020년 4월 19일
Hello.
I need to fit the following function to a set of data.
mymodel=@(a,x) (0.1744+0.1556*exp(-x/a));
xData=[ 1.0000
1.4142
2.2361
3.1623
4.1231
5.0990
6.0828
7.0711
8.0623
9.0554
10.0499
11.0454
12.0416
13.0384
14.0357
15.0333
16.0312
17.0294
18.0278
19.0263
20.0250
21.0238
22.0227
23.0217
24.0208];
yData=[ 0.3300
0.1896
0.1448
0.1216
0.1108
0.1128
0.1168
0.1064
0.1016
0.1040
0.1072
0.1012
0.1072
0.1068
0.1048
0.1084
0.1084
0.1104
0.1152
0.1112
0.1168
0.1164
0.1252
0.1136
0.1124];
ft=fit(xData,yData,mymodel)
figure(1)
plot(ft,xData,yData)
but I get poor fitting like this:
what is the problem?
Thank you in advance

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 4월 19일
편집: Ameer Hamza 2020년 4월 19일
Your model does not provide enough degree of freedom to fit all the points. Change the model to
mymodel=@(a,b,c,x) (b+c*exp(-x/a));

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by