       Re: Interpolation problems

• To: mathgroup at smc.vnet.net
• Subject: [mg120353] Re: Interpolation problems
• From: "Oleksandr Rasputinov" <oleksandr_rasputinov at hmamail.com>
• Date: Tue, 19 Jul 2011 07:00:24 -0400 (EDT)
• References: <ivmclp\$fbj\$1@smc.vnet.net>

```If you have difficulty finding a single functional form that fits your
data well enough to serve as an interpolation (cf. suggestions by Ray
Koopman and Jay Bee), you could try one of the following two approaches:

1. Expand your data in a basis of smooth, preferably analytic and
orthogonal functions, then sample values from the sum of basis functions
with whatever resolution you require. The documentation for LeastSquares
gives an example of how this could be done using piecewise cubic
functions, though I might choose Gaussians for this purpose.

2. Use a moving-window polynomial fit to obtain a piecewise approximation
while preserving higher derivatives, then sample the fitted polynomials.
This might be done via a generalization of the Savitzky-Golay method.

Both of these approaches should work reasonably well without too much
fine-tuning for the specific dataset, and both can be implemented
efficiently using standard linear algebra techniques, so a choice between
them would mainly be down to your preferences as to which you prefer to
program.

On Thu, 14 Jul 2011 10:25:13 +0100, James Womack
<james.c.womack at gmail.com> wrote:

> Hello all,
>
> I am having difficulty with interpolating a data set. My data is a
> function of one coordinate -- each data point consists of 2 numbers, one
> denoting position and one denoting the value of the function. If you are
> interested, the data represents a potential energy function.
>
> The best way to demonstrate my issue is to link to some images of plots.
>
> First, here is the result of:
> ListPlot[data, PlotRange -> {{0.4, 0.6}, {-350, 350}}, Joined -> True]
> http://jcwx86.dyndns.org/public/listplot.jpeg
>
> Second, here is the result of:
> Plot[Interpolation[data][x], {x, 0.4, 0.6}, PlotRange -> {-350, 350}]
> http://jcwx86.dyndns.org/public/interpolationfunction.jpeg
>
> These plots focus only on the relevant region of the data. The data
> spans x = 0.000857412 to x = 25.6297. The peak you see in the plots is
> cut off with a maximum value of the function at about y = 4000.
>
> As you can see, the interpolation results in two small additional minima
> at the base of the peak. This is problematic, since the function is a
> potential energy function and minima represent stable-states. Additional
> minima present in the data therefore result in problems with subsequent
> calculations using the InterpolationFunction of the data.
>
> I suspect that the issue is to do with the Interpolation command trying
> to fit the function to every datapoint. The rapid change in gradient at
> the base of the peak means that in order to fit splines to the function,
> these minima are necessary.
>
> Ideally, I would like an InterpolationFunction of the data that is (i)
> smooth and (ii) lacks these spurious minima. I have considered deleting
> data points from the base of the peak, as this might enable the splines
> to better fit the peak. Does anyone know of a way that I can modify the
> Interpolation command that enables a fit which better represents the
> data? Or perhaps you know of an alternative method of creating
> interpolated functions which might suit my needs better? I have already
> tried increasing the interpolation order -- this seems only to result in
> more "wobbles" at the base of the peak. Decreasing the interpolation
> order to 1 removes the minima, but also means the function is no longer
> "smooth".
>
> If you want to play around with the data yourself, I will post it below
> in full.
>