next up previous contents index
suivant: Exponentials and Logarithms monter: Fourier transformation précédent: Inverse Fast Fourier Transform   Table des matières   Index

An exercice with fft

Here are the temperatures T, in Celsius degree, at time t :
t 0 3 6 9 12 15 19 21
T 11 10 17 24 32 26 23 19
What was the temperature at 13h45 ?

Here N = 8 = 2*m. The interpolation polynomial is

p(t) = $\displaystyle {\frac{{1}}{{2}}}$p-m(exp(- 2i$\displaystyle {\frac{{\pi mt}}{{24}}}$) + exp(2i$\displaystyle {\frac{{\pi mt}}{{24}}}$)) + $\displaystyle \sum_{{k=-m+1}}^{{m-1}}$pkexp(2i$\displaystyle {\frac{{\pi kt}}{{24}}}$)

and

pk = $\displaystyle {\frac{{1}}{{N}}}$$\displaystyle \sum_{{k=j}}^{{N-1}}$Tkexp(2i$\displaystyle {\frac{{\pi k}}{{N}}}$)

Input :
q:=1/8*fft([11,10,17,24,32,26,23,19])
Output :
q:=[20.25,-4.48115530061+1.72227182413*i,-0.375+0.875*i,
-0.768844699385+0.222271824132*i,0.5,
-0.768844699385-0.222271824132*i,
-0.375-0.875*i,-4.48115530061-1.72227182413*i]

hence: Indeed

q = [q0,...qN-1] = [p0,..p$\scriptstyle {\frac{{N}}{{2}}}$-1, p-$\scriptstyle {\frac{{N}}{{2}}}$,.., p-1] = $\displaystyle {\frac{{1}}{{N}}}$FN([y0,..yN-1]) = $\displaystyle \tt
\frac{1}{N}fft(y)$

Input :
pp:=[q[4],q[5],q[6],q[7],q[0],q[1],q[2],q[3]]
Here, pk = pp[k + 4] for k = - 4...3. It remains to compute the value of the interpolation polynomial at point t0 = 13, 75 = 55/4, Input
t0(j):=exp(2*i*pi*(13+3/4)/24*j)
T0:=1/2*pp[0]*(t0(4)+t0(-4))+sum(pp[j+4]*t0(j),j,-3,3)
evalf(re(T0))
Output :
29.4863181684
The temperature is predicted to be equal to 29.49 Celsius degrees.
Input :
q1:=[q[4]/2,q[3],q[2],q[1],q[0]/2]
a:=t0(1) (ou a:=-exp(i*pi*7/48))
g(x):=r2e(q1,x)
evalf(2*re(g(a)))
or
2.0*re(q[0]/2+q[1]*t0(1)+q[2]*t0(2)+q[3]*t0(3)+q[4]/2*t0(4))
Output :
29.4863181684

Remark
Using the Lagrange interpolation polynomial (the polynomial is not periodic), input :
l1:=[0,3,6,9,12,15,18,21]
l2:=[11,10,17,24,32,26,23,19]
subst(lagrange(l1,l2,13+3/4),x=13+3/4)
Output :
$ \tt\displaystyle \frac{8632428959}{286654464}\simeq 30.1144061688$


next up previous contents index
suivant: Exponentials and Logarithms monter: Fourier transformation précédent: Inverse Fast Fourier Transform   Table des matières   Index
giac documentation written by Renée De Graeve and Bernard Parisse