MATLAB Answers

Converting data set (x,y) into a function f(x,y) not necessarily a polynomial fit .

2 views (last 30 days)
Anshuman S
Anshuman S on 26 Oct 2017
Commented: Anshuman S on 26 Oct 2017
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 Comments

Sign in to comment.

Accepted Answer

John D'Errico
John D'Errico on 26 Oct 2017
Edited: John D'Errico on 26 Oct 2017
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.

  1 Comment

Anshuman S
Anshuman S on 26 Oct 2017
Could you explain a bit more on modelling my data set. Yes, my data set is coming from an ultimate tensile test machine and I know the fundamental principles over which I am working .

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!