Derive equation from dataset

15 次查看(过去 30 天)
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 个评论
Alberto Basaglia
Alberto Basaglia 2019-2-26
Adam,
thank you for your answer. I am actually unsure of which equation or function would better fit the dataset, but I know the bounds and starting points.
If you have any suggestion given the dataset shape, please let me know.
Best
Adam Danz
Adam Danz 2019-2-26
I agree with the answer below. The curve fitting toolbox is a good start.

请先登录,再进行评论。

采纳的回答

Asad Mirza
Asad Mirza 2019-2-26
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 个评论
Alberto Basaglia
Alberto Basaglia 2019-2-27
Asad,
thank you for your answers. I used cftools and I think a Gaussian might fit the dataset accurately enough. Do you know if is it possible, and in case how, to set the max/min values of the function?
Thank you!
Walter Roberson
Walter Roberson 2019-2-27
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.

请先登录,再进行评论。

更多回答(1 个)

Walter Roberson
Walter Roberson 2019-2-26
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.

类别

Help CenterFile Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by