Re: Interpolation





In article <dqmufd$fru$1@xxxxxxxxxxxxxxxxxxxxxxxxx>,
"Rose" <rosy27@xxxxxxxxx> writes:
>
>Hi
>
>Is there any kind of interpolation like spline, nearest
>neighbor(weighted) that can be used for interpolating a nonuniform data
>?
>
>Suppose x = [1 2 4 5 6 8 9 10 12....]
>and y=f(x) = [0 -2 4 -3 5 -6....]
>and i want to find yy corresponding to xx = [1.8 5.8 9.8..]
>
>How should I proceed? And can somebody please tell me equations used in
>spline as applied to this example!!
>
>Thanks
>Rose
>

any interpolation method I know of can be applied in the nonequidistant case,
the question is the numerical effort for performing this and the form
of the error bounds. for a cubic spline it is very easy, the formulae
are in any numerical analysis text and code is in
http://www/netlib.org/dierckx.
here teh equations for the "natural" cubic soline (the spline with
second derivative at the ends equal to zero:

data (x(i),y(i)) i=0,...,n+1
set
h(i)=x(i)-x(i-1), i=1,...,n+1
set Matrix
A= [ 2(h(1)+h(2)), h(2), 0 , .... , 0 ] (first row)
[ 0...0 , h(i), 2(h(i)+h(i+1)), h(i+1), 0 ... 0] row i=2,...,n-1
[ 0,....,0 h(n), 2(h(n)+h(n+1)) ] row n
(A is tridiagoanl, so there are i-2 zeroes on the left and n-i-1 zeroes
on the right)
set the right hand side
b(i)=(y(i+1)-y(i))/h(i+1)-(y(i)-y(i-1))/h(i) ; i=1,..,n

solve the linear system
A*M=b
the M(i) have the meaning
M(i) = s''(x(i))/6.
then set
d(i)=y(i)-M(i)*h(i+1)^2 i=0,..,n
c(i)=(y(i+1)-y(i))/h(i+1)-(M(i+1)-M(i))*h(i+1) , i=0,...,n
with
M(0)=M(n+1)=0
then
s(x)= (M(i+1)*(x-x(i))^3+M(i)*(x(i+1)-x)^3)/h(i+1)+c(i)*(x-x(i))+d(i)
for x(i)<=x<=x(i+1) i=0,..,n
is the equation for the spline
hth
peter


.



Relevant Pages

  • Re: Interpolation : value at endpoint.
    ... interpolation problematics at the boundaries of interpolation ... The name spline itself goes back to this same thin ... The traditional cubic spline is a C2 ... knot and the penultimate knot, ...
    (comp.soft-sys.matlab)
  • Re: Confusion about splitting classes to allow sharing of resources
    ... I have a working Spline ... >> Along with the splines for x and y, the Curve class also has one ... >> Adding new interpolation variables in subclasses of Curve will then ... instantiate the relevant Nodes and add them to the R5 ...
    (comp.object)
  • Re: Confusion about splitting classes to allow sharing of resources
    ... Then the Spline would ... actual interpolation to the algorithm de jour one set of points at a time. ... regeneration behavior since it is the only one that uses the data. ...
    (comp.object)
  • Re: Confusion about splitting classes to allow sharing of resources
    ... > both the algorithm and the data. ... Then the Spline would ... > between spline flavors are the interpolation algorithm, ... It's the responsibility of this 'somebody' I am still a bit confused ...
    (comp.object)
  • Re: Numerical integration at arbitrary x
    ... >> unknown positions using a high order local interpolation. ... >> with the grid halved and applied tio the spline in order to get the ... >> you also could use a nonequidistant fft for smoothing, ... depending on the integration order you end up selecting. ...
    (sci.math.num-analysis)