Converting data set (x,y) into a function f(x,y) not necessarily a polynomial fit .
2 次查看(过去 30 天)
显示 更早的评论
Is there any way on MATLAB by which I can find an equation from my data set , I know there are a number of curve fitting methods in numerical methods; but I want a new function ( equation ) for my data set . e.g. any function like log(a(tan(bx))) . I know it's very vague to ask such a thing but I have a data from my experiment for which I want to establish my own equation . Thanks
0 个评论
采纳的回答
John D'Errico
2017-10-26
编辑:John D'Errico
2017-10-26
In general, NO. This is impossible to do, to infer the real function that lies beyond some data.
If you have function values, they are never exactly the true values anyway. For example,
x = linspace(0,1,8)
x =
Columns 1 through 6
0 0.142857142857143 0.285714285714286 0.428571428571429 0.571428571428571 0.714285714285714
Columns 7 through 8
0.857142857142857
Is x(2) exactly 1/7 anyway? NO! x(2) is a floating point approximation to 1/7. The true number is a infinite decimal, never terminating. But x(2) is just an approximation.
y = x.^2
y =
Columns 1 through 6
0 0.0204081632653061 0.0816326530612245 0.183673469387755 0.326530612244898 0.510204081632653
Columns 7 through 8
0.73469387755102 1
Again, even something as simple as this has values that are NOT exactly represented. x(2) is NOT 1/49. It is only an approximation.
sprintf('%0.55f',y(2))
ans =
'0.0204081632653061208204636756136096664704382419586181641'
vpa(sym('1/49'))
ans =
0.020408163265306122448979591836735
As you can see, they are not the same.
So you cannot even store those numbers. Now, can you find a function that will predict not only the approximate values, but also somehow magically know that you really intended to have the true values behind those approximations?
How could any tool be intelligent enough to do so? Software cannot do this. I've heard of tools that try. They don't do it well.
Worse, for any given set of points, there are infinitely many functions that will pass through any set of points. So even if you did find "THE" function that represents your data, there are infinitely many alternative functions that will predict that data EXACTLY as well. Which one is correct?
At best, you can intelligently provide a model that represents this relationship. It is best if your model comes from physical principles that model the relation. Then you use a regression tool to estimate the parameters of that model.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Linear and Nonlinear Regression 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!