MATLAB Answers

Function of the interpolation function

8 views (last 30 days)
Philipp Siebel
Philipp Siebel on 25 Jun 2018
Answered: John D'Errico on 25 Jun 2018
I have interpolate between some measurement points. Now I want to get the function which describes the interpolation curve. Is there any possibility ??
Thank you for your help.

  0 Comments

Sign in to comment.

Answers (1)

John D'Errico
John D'Errico on 25 Jun 2018
Um, you said interpolation, but you never said what kind of interpolation was used. The crystal ball is very foggy today, so I am having trouble reading your mind.
Anyway, this is a common question, with almost always the answer being no, you cannot. Well, you could, but it would just not be worth the effort. The interpolation function will just be a mess of coefficients, none of which would make any sense to you, or be of any value. And as I said, there are LOTS of different ways to interpolate, even if you restrict that to interp1, or to tools like interp2, griddata or scatteredInterpolant.
For example, reading the help for interp1, I see all this:
'linear' - (default) linear interpolation
'nearest' - nearest neighbor interpolation
'next' - next neighbor interpolation
'previous' - previous neighbor interpolation
'spline' - piecewise cubic spline interpolation (SPLINE)
'pchip' - shape-preserving piecewise cubic interpolation
'cubic' - same as 'pchip'
'v5cubic' - the cubic interpolation from MATLAB 5, which does not
extrapolate and uses 'spline' if X is not equally
spaced.
'makima' - modified Akima cubic interpolation
Every single one of those methods would result in a completely different "function". And every one of them would be just a mess of coefficients that would be of no real value to you. (Ok, 'nearest', 'next', and 'previous' would be relatively easy to write down. But even then, the "function" would be mainly just a list of numbers, just the data you passed in.)
If you truly, desperately wanted to see the actual cubic polynomials generated in a spline interpolant, for example, I have provided tools that can output those functions, written in symbolic form. But why would you bother?

  0 Comments

Sign in to comment.


Translated by