Previous Up Next

6.26.4  An exercise with fft

Given temperatures T at time t, in degrees Celcius:

t036912151921
T1110172432262319

What was the temperature at 13h45 ?

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

p(t)=
1
2
 pm(exp(−2i
π mt
24
)+ exp(2i
π mt
24
))+
m−1
k=−m+1
pk exp(2i
π kt
24

and

pk=
1
N
 
N−1
k=j
Tk exp(2i
π k
N

Input:

q:=1/8*fft([11,10,17,24,32,26,23,19])

Output:

     
  
 20.25,−4.48115530061+1.72227182413 i,0.375+0.875i,         
  −0.768844699385+0.222271824132, i,0.5,         
  −0.768844699385−0.222271824132, i,         
 
 0.375−0.875i, −4.48115530061−1.72227182413i
         

hence:

Indeed

q=[q0,… qN−1]=[p0,..p
 
N
2
−1
,p
 
N
2
,..,p−1]=
1
N
FN([y0,..yN−1])=
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 degrees Celsius.


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)
evalf(ans())

Output:

30.1144061688

Previous Up Next