       Re: Help with Spline Interpolation

• To: mathgroup at smc.vnet.net
• Subject: [mg113223] Re: Help with Spline Interpolation
• From: Christopher Arthur <aarthur at tx.rr.com>
• Date: Tue, 19 Oct 2010 05:56:30 -0400 (EDT)

```Hi Tim,

As an experiment, try to put a point on either side of the bounds so
that the spline isn't terminating at 2 and 20 but flows through it...see
if the derivatives are better then.  Perhaps the endpoints are not
differentiable in the model, and that is why the problem is.
Christopher Arthur

Tim McShane a écrit :
> Hi,
> I am trying to interpolate 5 data points using spline curves in
> Mathematica using the Interpolation function.  I also want to specify
> the first derivative or slope of the spline curve at the end points
> only.  This is known as a "clamped" cubic spline.
> I used the following code:
>
> data1={{{2},3,-1},{{5},4,Automatic},{{9},6,Automatic},{{14},7,Automatic},{{20},5,1}}
>
>
> data1Plot=Table[{data1[[i,1,1]],data1[[i,2]]},{i,1,Length[data1]}]
>
> sfun=Interpolation[data1,Method->"Spline"]
>
> grfx1=ListPlot[data1Plot,AxesOrigin=EF=82=AE{0,0}];
> grfx2=Plot[sfun[x],{x,2,20}];
> Show[grfx1,grfx2]
>
> sfun'
> 0.139481
>
> sfun'
> -0.63457
>
> This draws a smooth curve through the data points but does not
> reproduce the specified first derivatives at the end points.  The
> slope at the beginning and end points should be -1 and 1
> respectively.  The interpolating function returned by Mathematica
> gives 0.139 and -0.635
>
> Thank you,
> Tim McShane
>
>
>
>

```

• Prev by Date: Re: ListAnimate
• Next by Date: Re: Nested list - adding to each entry
• Previous by thread: Help with Spline Interpolation
• Next by thread: Re: Help with Spline Interpolation