Presentation is loading. Please wait.

Presentation is loading. Please wait.

INTERPOLATION For both irregulary spaced and evenly spaced data.

Similar presentations


Presentation on theme: "INTERPOLATION For both irregulary spaced and evenly spaced data."— Presentation transcript:

1 INTERPOLATION For both irregulary spaced and evenly spaced data.

2 Linear Interpolation x = a x = b y x x

3

4 Linear Interpolation

5 Spline & Linear Interpolation

6 The function should be continuous at the joints.
Spline interpolation – we approximate the interpolation function y(x) over the interval [a, b] by dividing the interval into subregions. The function should be continuous at the joints. Define spline function y(x) of degree N with joints: b a data need to be in ascending (or descending order); if not, it should be rearranged Spline function y(x) has two properties: a) In each interval ui-1  x  ui (i = 1,…, m), the function y(x) is a polynomial of degree < N. b) At each interior joint, y(x) and its first N-1 derivatives are continuous.

7 The most common spline function is the cubic spline N = 3
Example. Consider a data series with elements (xi, yi), i =1, …, N The first two derivatives y’(x) and y’’(x) of the interpolation function can be defined for all xi The third derivative y’’’(x) is a constant for all x At the segment junctions: Continuity of the spline function Continuity of the slope Continuity of the curvature

8 Since y’’’(x) is a constant, y’’(x) must be linear, so that
Integrating twice, getting integration constants from a) continuity of the function and b) of the slope:

9 Cubic Spline Fifth degree polynomial Sixth degree polynomial Eighth degree polynomial = cubic spline for this example

10 clear all close all x=[ ]; y=[ ]; plot(x,y,'o','MarkerFaceColor','red','MarkerSize',10) axis([ ]) ; set(gca,'FontSize',18) x1=[3:.25:9]; y1=interp1(x,y,x1); hold on plot(x1,y1,'b','LineWidth',3) y2=interp1(x,y,x1,'spline'); plot(x1,y2,'r','LineWidth',4) %Shape-preserving piecewise cubic interpolation. %The interpolated value at a query point is based on a shape-preserving %piecewise cubic interpolation of the values at neighboring grid points. y3=interp1(x,y,x1,'pchip'); plot(x1,y3,'k','LineWidth',2)


Download ppt "INTERPOLATION For both irregulary spaced and evenly spaced data."

Similar presentations


Ads by Google