Re: Interpolation problems
- To: mathgroup at smc.vnet.net
- Subject: [mg120267] Re: Interpolation problems
- From: Ray Koopman <koopman at sfu.ca>
- Date: Fri, 15 Jul 2011 05:26:20 -0400 (EDT)
- References: <ivmclp$fbj$1@smc.vnet.net>
On Jul 14, 2:25 am, James Womack <james.c.wom... 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. > > Thanks in advance for your thoughts, > > James > > data = << ...deleted... >> Except for the glitch near x = .53, a plot of the data resembles a left-truncated Cauchy probability density. Using only the first 200 points (x < .48): Clear[b,c,d,x]; FindFit[Take[data,200], b/(c^2 + (x-d)^2), {b,{c,.01},{d,.002}}, x] {b -> 0.951445, c -> 0.00793639, d -> 0.00200581} Using all but points 201...216 (.48 < x < .60) gives the same coefficients to 6 significant digits. Try fitting something to the residuals, y - f[x]. I tried another Cauchy, but it didn't work. I suspect there is simply not enough data to support blind curve-fitting. You would need more points in (.48, .60). Do you have substantive information that might suggest the form of the second function?