CE206 Fourier Analysis
CE206 Fourier Analysis
Computation Sessional
Fourier Analysis
Periodic Functions
A periodic function is one for which
f(t) = f(t + T)
where T = the period
f (t ) = a0 + ak cos(k0t ) + bk sin( k0t ) f (t ) = k
~ e ik0t
c
k =1 k = −
Coefficients: Coefficients:
2 T 1 T /2
ak = f (t ) cos(k0t )dt ~
ck = f (t )e −ik0t dt
T 0 T −T / 2
2 T
bk = f (t ) sin( k0t )dt
T 0
j =0
for k = 0 to n-1
n −1
1
Inverse Fourier transform: fk = k
n k =0
F e ik0 j for j = 0 to n-1
2
0 =
n
Solution:
Sampling frequency = (1/0.02s) = 50Hz
Total sample length = 8/50 = 0.16s
The Nyquist frequency = 0.5*50 = 25Hz
(The highest frequency that can be measured in a signal is called the Nyquist
frequency and is half the sampling frequency)
Therefore, the analysis should be able to detect signals with periods from
1/25 = 0.04 upto 1/6.25 = 0.16s.
subplot(3,1,2);
stem(f,real(YP),'linewidth',2,'MarkerFaceColor','blue');
grid; title('(b) Real component versus frequency')
subplot(3,1,3);
stem(f,imag(YP),'linewidth',2,'MarkerFaceColor','blue');
grid; title('(c) Imaginary component versus frequency')
Power = sum of
square of Fourier
coefficients
Pk = c~k
2
figure(2)
Pyy=abs(YP).^2;
stem(f,Pyy,'linewidth',2,'MarkerFaceColor','blue');
title ('Power Spectrum'); xlabel('Frequency (Hz)');
CE 206: Engg. Computation sessional Dept. of Civil Engg., BUET
Example Problem: Wolf Sunspot Number
The data for year-wise sunspot number are contained in the
MATLAB file sunspot.dat. Perform Fourier analysis on the time
series data and determine the cycle length. Compare it to J.R. Wolf’s
estimate of cycle length (~11.1 years).
clear all; close all;
load sunspot.dat
year=sunspot(:,1);
number=sunspot(:,2);
n=length(number);
a=polyfit(year, number,1); Removing the
lineartrend=polyval(a,year); upward linear
ft=number-lineartrend;
trend of the data
F=fft(ft);
fs=1; f=(0:n/2)*fs/n;
pow=abs(F(1:n/2+1)).^2;
plot(f,pow)
xlabel('Frequency (cycles/year)'); ylabel('power')
title('Power versus frequency')