Improving fit of custom function
显示 更早的评论
Hello,
I have the following curve.
I want to fit it into a closed-form equation. I tried to use GRABIT to get a vector of values that could plot it.
x = [0.0194119350975558 0.248031785422458 0.291351961297183 0.334455968629621 0.397706884103397 0.439513880182100 0.459876956865727 0.644744294231326 0.658622314646282 0.755249653049490 0.832378588938224 0.889360616685617 0.929005927341429 0.970164417793265 0.990095157392316 1.05248139869694 1.11508380854384 1.20042714903956 1.24439583054116 1.26670442410539 1.33211702500205 1.40033981694848 1.46964345160635 1.56039100565929 1.58464511610412 1.60738604675293 1.67279864764960 1.73734657437711 1.84391766572561 1.92839633205217 1.99143107898366 2.07482890259878 2.26069061525890 2.34387227033173 2.42813476811600 2.53492202800680 2.62113004267167 2.70712188879425 2.73029515652764 2.81693550827709 2.88234810917376 2.98956770614913 3.07491104664485 3.18169830653564 3.28783706079956 3.47910298701692 9.89096458726940]
y = [0.382895015585752 0.936494005646322 0.944570062386241 0.950609811457797 0.946433435220773 0.940255338282152 0.932075520641934 0.473525838625860 0.404256790934756 0.314486318692959 0.241040894764830 0.177811596145283 0.151270422523033 0.138983402579323 0.126730969602380 0.114409362691904 0.104124063449791 0.108058330919451 0.122243310664459 0.132390262039507 0.148576962486111 0.191235662621433 0.244075901098568 0.298917860277301 0.327391580667615 0.341611147379389 0.357797847825993 0.365839317599146 0.369738998102040 0.365528034898250 0.359315350992862 0.344922849447257 0.295740182705652 0.279311373491684 0.273064102619530 0.279000090790788 0.291079588933900 0.301122779408649 0.319414961457149 0.335567074936987 0.351753775383591 0.361762378891574 0.365696646361235 0.371632634532492 0.371459699698661 0.373184724666128 0.372920999044535]
However, I am trying to fit that into an equation, whatever it is. Is that possible? If so, how can I do that
Thanks,
8 个评论
Alex Sha
2020-8-10
Hi, Romio, try the function below:

the result looks like
Root of Mean Square Error (RMSE): 0.0164680720875248
Sum of Squared Residual: 0.0127462777191559
Correlation Coef. (R): 0.997605685335972
R-Square: 0.995217103414654
Adjusted R-Square: 0.994999699024412
Parameter Best Estimate
---------- -------------
a1 28.2993073175648
b1 3.32511705171217
c1 1.70848647801981
a2 -28.2201167066288
b2 3.28581368132734
c2 1.70701890200917
a3 0.77982690236299
b3 12.2096037131267
c3 0.353892339357631
a4 0.460078496780701
b4 0.0192405314867751
c4 6.58320320787442

Romio
2020-8-10
Alex Sha
2020-8-11
Hi, Romio, the above result is obtained by using a software package named "1stOpt".
Walter Roberson
2020-8-11
http://www.7d-soft.com/en/products.htm produces 1stOpt .
Alex has posted some very nice fits obtained with that software; it looks useful.
Romio
2020-8-11
Walter Roberson
2020-8-12
No, Alex just reported the software he is using when you asked; he did not say it is free.
Alex has posted responses to a number of optimization / fitting questions over the last couple of years, making use of that software to find values. I do sometimes find better values than that software obtains, but the software is producing outputs within a quite small number of minutes, whereas it may take me several hours of work to locate an improved point. For people who do a lot of fitting or optimization, it appears to me that the software he is using is good value for the price. But, Yes, it does cost a fair bit, and Yes, that does effectively act to keep most students from using that other software.
Rena Berman
2020-10-12
(Answers Dev) Restored edit
回答(1 个)
Sulaymon Eshkabilov
2020-8-10
0 个投票
Hi,
Why not to use cftool (Curve Fitting Toolbox).
- Launch it with: >> cftool
- Indicate your x data and y data variable names in GUI window of cftool
- Select the available fit models or enter your custom equation
Good luck.
类别
在 帮助中心 和 File 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!