Derive equation from dataset
6 views (last 30 days)
Show older comments
Alberto Basaglia
on 26 Feb 2019
Commented: Walter Roberson
on 27 Feb 2019
Hello!
I have the following four sets of data:
x11=[0 8 32 35 38 46 50 62];
y11=[288 288 224 183 155 29 23 0];
x12=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 26 35 36 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 71];
y12=[1830 1830 1830 1779 1779 1779 1779 1481 1481 1225 1225 1128 1128 995 995 707 707 682 682 661 661 607 515 511 344 344 344 339 339 339 332 332 332 319 319 319 305 305 305 261 261 261 249];
x21=[0 12 18 20 22 23 24 26 31 32 35 37 38 39 48 50 54 57];
y21=[715 715 670 643 639 616 612 581 521 466 421 369 318 326 109 55 7 0];
x22=[0 5 6 9 16 21 22 23 24 35 37 38 40 44 48 58 72 73 77];
y22=[6833 6833 6776 5704 2497 1893 1779 1706 1741 1444 1335 1256 1217 967 947 812 649 593 551];
All x-y pairs have quite the similar shape, with the curve decaying rapidly in the first half and then slowly in the second one.
The goal is to interpolate each x-y pair to derive an equation that will represent the phenomenon.
I tried interp1 and lsqcurvefit but they don't give good enough results. Could someone suggest an alternative way to interpolate these data?
Thank you!
3 Comments
Accepted Answer
Asad Mirza
on 26 Feb 2019
Since you do not know what could be the best function to fit your data with try out the Curve Fitting App with cftool. It lets you fit data using a wide range of functions, apply bounds, weights, etc. You even have the option of making your own equation to fit it with.
2 Comments
Walter Roberson
on 27 Feb 2019
Are you looking to set maximum and minimum values of a parameter to be fitted?
If so then click on Fit Options... which will bring up a window listing coefficient names with a column named Lower and another column named Upper. It turns out that the entries in those two columns are clickable, and you can edit the upper and lower bounds there.
More Answers (1)
Walter Roberson
on 26 Feb 2019
There are an infinite number of equation that fit your data perfectly in theory , even without allowing for the possibility of noise or of imperfect recording of coefficients .
The number of equation you can derive from the data using no more than 2^48 bytes of memory (limit of x64 architecture in all known implementation ) representing your coefficients as IEEE double precision (64 bits) is a bit more limited but probably still over 2^40
With an infinite number of derived equations, the probability that any one of them is the "correct" equation is 1/infinity which is defined as 0.
Therefore you cannot do anything useful in fitting your data unless you can restrict your equation to being one of a finite number of forms, after which you can do parameter fitting for each of the possible forms and make a decision as to which fits best.
0 Comments
See Also
Categories
Find more on Get Started with Curve Fitting Toolbox 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!