








Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!









Simple idea– Connect straight lines between data points– Any intermediate value read off from straight line
-^
The
local variable
s , is
s^
x - x
k
The
first divided difference
is
δk
yk
- y
)/(xk
k +
–x
)k
With these quantities in hand, the interpolant is
-^
( x
y
k^
x – x
) ( k
yk
- y
)/(xk
k +
–x
)k
y
k^
s
δk
Linear function that passes through (
xk
, y
) and ( k
xk
, y
k +
Same format as allother interpolants
-^
Function diff findsdifference ofelements in a vector
-^
Find appropriatesub-interval
-^
Evaluate
-^
Jargon:
x
is called a
“knot” for the linearspline interpolant
function v = piecelin(x,y,u)%PIECELIN Piecewise linear interpolation.% v = piecelin(x,y,u) finds piecewise linear L(x)% with L(x(j)) = y(j) and returns v(k) = L(u(k)).% First divided differencedelta = diff(y)./diff(x);% Find subinterval indices k so that x(k) <= u <x(k+1)n = length(x);k = ones(size(u));for j = 2:n-1k(x(j) <= u) = j;end% Evaluate interpolants = u - x(k);v = y(k) + s.*delta(k);
While we expect function not to vary, we expect it to alsobe smooth
-^
So we could consider piecewise interpolants of higherdegree
-^
How many pieces of information do we need to fit acubic between two points?– y=a+bx+cx
2 +dx
3
However for Hermite, the derivative needs to be specified
-^
Cubic splines, the derivative is not specified but enforced
n-2 equations in n unknowns
Assume natural splines
-^
This is a tridiagonal system
-^
Can be solved in
O(n)
operations
How?– Do LU and solve– With tridiagonal structure requires O(7n) operations
Interpolation: Given a function at
points, find its value at
other point(s)
-^
Polynomial interpolation– Monomial, Newton and Lagrange forms
-^
Piecewise polynomial interpolation– Linear, Hermite cubic and Cubic Splines
-^
Polynomial interpolation is good at low orders
-^
However, higher order polynomials “overfit” the data anddo not predict the curve well in between interpolationpoints
-^
Cubic Splines are quite good in smoothly interpolating data