Fitting an exponential function: Setting options?
显示 更早的评论
Hello,
I would like to fit a custom specific equation and get an error message. My code is as follows:
T_K = [250.150000000000 253.150000000000 263.150000000000 273.150000000000 283.150000000000 293.150000000000 303.150000000000 313.150000000000 323.150000000000 333.150000000000 343.150000000000 353.150000000000 363.150000000000 373.150000000000 383.150000000000 393.150000000000 403.150000000000 413.150000000000 423.150000000000 433.150000000000 443.150000000000 453.150000000000 463.150000000000 473.150000000000 483.150000000000 493.150000000000 503.150000000000 513.150000000000 523.150000000000 533.150000000000 543.150000000000 553.150000000000 563.150000000000 573.150000000000 583.150000000000 593.150000000000 603.150000000000 613.150000000000]'
d = [985 983 976 969 962 955 948 940 933 926 919 912 904 897 890 882 875 867 859 852 844 836 828 820 812 803 795 786 777 768 759 750 740 730 720 710 699 688]'
f = fittype('A/(B * exp(1+ (1 - T_K/C)^D))',...
'dependent',{'d'},'independent',{'T_K'},...
'coefficients',{'A','B','C','D'});
fit2 = fit(T_K, d, f);
The error I get is in the fit function: [fitobj, goodness, output, convmsg] = iFit( xdatain, ydatain, fittypeobj, ...
My idea was that it could be a mathematical problem with the exponential function. After having read this I tried to set some options (lower bounds, where I was not sure about the order:
options = fitoptions('A/(B * exp(1+ (1 - T_K/C)^D))', 'Lower', [0 Inf Inf 1]);
), but it was without success. Does anybody has an idea about what is wring or the problem could be?
4 个评论
David Goodmanson
2021-2-15
Hi Caroline, this comment is not on the code itself but just on the fact that A and B only come into the fit as the ratio A/B. That makes the problem underdefined. So you can, e.g. drop the B factor entirely and let A stand for the previous A/B.
Caroline Otto
2021-2-15
Walter Roberson
2021-2-15
You did not say what the error is ?
Caroline Otto
2021-2-15
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Interpolation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
