# 18 - Splines Another form of interpolation Instead of using...

This preview shows pages 1–3. Sign up to view the full content.

3/24/2010 1 Splines: Another form of interpolation. Instead of using a single function (as in polynomial interpolation) separate functions are used between each pair of data points. Name omes from fle ible spline sed in draftin to dra a smooth re point Name comes from flexible splines used in drafting to draw a smooth curve point through a series of points (though linear splines won’t look much like this, cubic splines will). Conventions: n points ( x 1 through x n ), n –1 intervals s i ( x ) used between x i and x i+1 y i = y value at x i (note: text uses f ( x i ), f i ) s 1 ( x ) s 2 ( x ) s 3 ( x ) s 4 ( x ) s n 1 ( x ) x 1 x 2 x 3 x 4 x 5 x n 1 x n …. …. o o o o o o o Linear Splines: Straight lines used between data points Same thing as piecewise linear interpolation i i i i i i i i i i i i i y y x x y y b y a x x b a x s 1 1 1 ) ( ) ( i i i i i x x x x y x s 1 ) ( ) ( < Diagram needed >

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
3/24/2010 2 Matlab: yout = interp1 (x, y, xin, ‘linear’); x, y = data points xin = x values of interest yin = y values of linear spline at a values of interest Each interval involves two variables ( a , b ) There are therefore a total of 2( n –1) variables Each s i ( x ) must pass through ( x i , y i ) and ( x i+1 , y i+1 ): There are therefore 2( n 1) equations. In practice it is not necessary to work out all of the a ’s and b ’s 1 1 ) ( ) ( i i i i i i y x s y x s s and s The concept will make more sense with quadratic and cubic splines In order to find the value of a linear spline for a given x it is only necessary to i) Locate the correct interval ii) Perform linear interpolation between the interval end points function [ yout ] = linearSpline( x, y, xin ) yout = zeros(size(xin)); for k = 1 : length(xin) xval = xin(k); % for convenience lo = 1; hi = length(x);
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 7

18 - Splines Another form of interpolation Instead of using...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online