
exponential curve fitting with custom equation
2 views (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
Ameer Hamza
on 19 Apr 2020
Edited: Ameer Hamza
on 19 Apr 2020
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 Comments
More Answers (0)
See Also
Categories
Find more on Fit Postprocessing 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!