MATLAB Answers

interpolation for ode problems

16 views (last 30 days)
What is the use of interpolation? Can I use this function for random data? especially for the application of ode

Accepted Answer

Walter Roberson
Walter Roberson on 5 Nov 2016
"Can I use this function for random data?"
Yes. However, the interpolation will not be meaningful unless the random data is correlated at higher orders than you interpolate at. For example you might be able to do some meaningful linear interpolation of a random function of two variables that can be expressed through a covariance matrix.
"especially for the application of ode"
Yes, you can do interpolation within the objective function for one of MATLAB's ode* calls. However, the interpolation that you use must be continuous to at least 2 more derivatives than the highest derivative that you are using in your ode, and must be continuous to 7 more derivatives than the highest derivative that you are using in your ode if you configure the ode to use RK45.
For example, if your ode used only a single derivative, f'(y), and you did not use RK45, then you could use cubic interpolation as that would be continuous to the 3rd derivative (2 more than the single derivative you are using.) However, if you used second derivatives f''(y) then you would not be able to use cubic spline interpolation without problems, because that is only degree 3 which is not at least 2 higher than the 2nd derivative f''(y) needs.
If you use linear interpolation, then the ode solvers will get stuck. If you use interpolation of degree 2, then the ode solvers will not necessarily get stuck, but they will produce incorrect answers if they do not get stuck.

More Answers (1)

Jan
Jan on 4 Nov 2016
You get an exhaustive explanantion of the meaning of interpolations, when you ask WikiPedia are spend the time to search for another reference in the forum. It is inefficient, if the forum users do this web search for you an post the links here. So please try this by your own at first and ask a specific question, if a detail does not get clear.
An interpolation is used to resample a signal with another frequency. If you've measured a value e.g. twich at t=0 and t=1 only and want to get the value at t=0.6, you can interpolate the signal by (Pseudo-code):
Signal_of_intermediate_t = Signal(t=0) * 0.4 + Signal(t=1) * 0.6;
This is a linear interpolation between the two measurement points. You could get 1000 interpolated points between the two times also. This linear interpoltion is weak, if the signal is noisy: for random data, you cannot assume that the signal has a linear progress between the points.
For the "application in ODE" -what ever this means- consider, that Matlab's ODE integrators handle only smooth functions reliably. A linear interpolation has discontinuities in the gradient, such that the step size control is out of its specifications. This might let the integrator stop with an error message, if you are lucky. Without luck, you get a result with a low accuracy without noticing it. Therefore linear interpolations are forbidden in ODEs, but higher order methods wil work.
  2 Comments
Walter Roberson
Walter Roberson on 5 Nov 2016
kiran gk: what information would you have needed in order for the response to be useful?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!