Title: Lecture 20: Trigonometric interpolations
1Lecture 20 Trigonometric interpolations
Download triginterp.m
Calculate trig interpolation at interval t0,
tn In p points based on interpolation in n points
2t0-10 tn10 n50 pn10 tt0(tn-t0)(0n-1
)/n n evenly-spaced time
points tpt0(tn-t0)(0p-1)/p p
evenly-spaced time points f
inline('exp(-t.2)') test function to
interpolate xf(t) xexactf(tp) yfft(x)
apply DFT ypzeros(p,1)
yp will hold coefficients for
ifft yp(1n/21)y(1n/21) move n
frequencies from n to p yp(p-n/22p)y(n/22n)
same for upper tier xpreal(ifft(yp))(p/n)
invert fft to recover data errorxp-xexact' su
bplot(2,1,1) plot(t,x,'o',tp,xp) plot
data points and interpolant title('trigonometric
nterpolation') subplot(2,1,2) plot(tp,error,'o'
) plot error title('error')
3(No Transcript)
4Gibbs phenomenon
Example of Gibb's phenomenon - failure of trig
interpolation for nonperiodic functions t00 tn1
0 n50 pn10 tt0(tn-t0)(0n-1)/n
n evenly-spaced time points tpt0(tn-t0)(0p-1)/
p p evenly-spaced time points f
inline('exp(-t.2)') test function to
interpolate xf(t) xexactf(tp) yfft(x)
apply DFT ypzeros(p,1)
yp will hold coefficients for
ifft yp(1n/21)y(1n/21) move n
frequencies from n to p yp(p-n/22p)y(n/22n)
same for upper tier xpreal(ifft(yp))(p/n)
invert fft to recover data errorxp-xexact' su
bplot(2,1,1) plot(t,x,'o',tp,xp) plot
data points and interpolant title('trigonometric
nterpolation') subplot(2,1,2) plot(tp,error,'o'
) plot error title('error')
5Download triginterpgibbs.m
6(No Transcript)
7Inclass
Interpolate function exp(-x4) at interval
-10,10 from 50 equally spaced points. Plot your
result.