0% found this document useful (0 votes)
68 views16 pages

CE206 Fourier Analysis

The document discusses Fourier analysis and periodic functions. It defines periodic functions and introduces sinusoids using different parameters. It discusses representing sinusoids using alternative expressions and the relationship between time and frequency domains. It also covers Fourier series approximation and the discrete Fourier transform (DFT) used to analyze discrete data. MATLAB's built-in fft function is introduced to efficiently compute the DFT. An example problem demonstrates applying the DFT to a simple sinusoidal signal and interpreting the results. The document concludes with an example of applying Fourier analysis to sunspot number time series data to determine the sunspot cycle length.

Uploaded by

sazid alam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views16 pages

CE206 Fourier Analysis

The document discusses Fourier analysis and periodic functions. It defines periodic functions and introduces sinusoids using different parameters. It discusses representing sinusoids using alternative expressions and the relationship between time and frequency domains. It also covers Fourier series approximation and the discrete Fourier transform (DFT) used to analyze discrete data. MATLAB's built-in fft function is introduced to efficiently compute the DFT. An example problem demonstrates applying the DFT to a simple sinusoidal signal and interpreting the results. The document concludes with an example of applying Fourier analysis to sunspot number time series data to determine the sunspot cycle length.

Uploaded by

sazid alam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

CE 206: Engineering

Computation Sessional

Fourier Analysis
Periodic Functions
A periodic function is one for which
f(t) = f(t + T)
where T = the period

CE 206: Engg. Computation sessional Dept. of Civil Engg., BUET


Sinusoids
f(t) = A0 + C1cos(0t + )

Mean Angular Phase


value Amplitude frequency shift

CE 206: Engg. Computation sessional Dept. of Civil Engg., BUET


Alternative Expressions of Sinusoids
f(t) = A0 + A1cos(0t) + B1sin(0t)

The two forms are related by


2 2
C1 = A1 + B1  = arctan(-B1/A1)
CE 206: Engg. Computation sessional Dept. of Civil Engg., BUET
Time vs. Frequency Domains
Frequency domain
provides an alternative
perspective for
characterizing the
behavior of oscillating
functions

CE 206: Engg. Computation sessional Dept. of Civil Engg., BUET


Fourier Series approx. and transform

CE 206: Engg. Computation sessional Dept. of Civil Engg., BUET


Fourier Series and Fourier Transform
Continuous Fourier Series: Compact form:

 
f (t ) = a0 +  ak cos(k0t ) + bk sin( k0t ) f (t ) = k
~ e ik0t
c
k =1 k = −

Coefficients: Coefficients:

2 T 1 T /2
ak =  f (t ) cos(k0t )dt ~
ck =  f (t )e −ik0t dt
T 0 T −T / 2

2 T
bk =  f (t ) sin( k0t )dt
T 0

CE 206: Engg. Computation sessional Dept. of Civil Engg., BUET


Discrete Fourier Transform (DFT)
In engineering, data are often collected in or converted to discrete
format.
n −1

Discrete Fourier transform: Fk =  j


f e −ik0 j

j =0
for k = 0 to n-1

n −1
1
Inverse Fourier transform: fk =  k
n k =0
F e ik0 j for j = 0 to n-1

2
0 =
n

CE 206: Engg. Computation sessional Dept. of Civil Engg., BUET


MATLAB built-in function: fft
DFT is computationally
burdensome.

A Fast Fourier Transform (FFT)


algorithm has been developed to
compute the DFT in an
economical fashion.

MATLAB has a built-in function


to compute FFT
F = fft(f,n)

F = a vector containing the DFT


F = a vector containing the signal/ discrete measurements
CE 206: Engg. Computation sessional Dept. of Civil Engg., BUET
Example Problem: DFT
Apply MATLAB’s fft function to determine the DFT for a simple
sinusoid:
f(t) = 5 + cos(2(12.5)t) + sin(2(18.75)t)
Generate 8 equispaced points with Δt = 0.02 s. Plot the results
versus frequency

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)

Lowest detectable frequency = 1/0.16s = 6.25Hz

Therefore, the analysis should be able to detect signals with periods from
1/25 = 0.04 upto 1/6.25 = 0.16s.

CE 206: Engg. Computation sessional Dept. of Civil Engg., BUET


Example Problem: DFT
clc; clear all; close all;
n=8; dt=0.02; fs=1/dt; T=0.16;
tspan=(0:n-1)/fs;
y=5+cos(2*pi*12.5*tspan)+sin(2*pi*18.75*tspan);
subplot(3,1,1);
plot(tspan,y,'-
ok','linewidth',2,'MarkerFaceColor','black');
title('(a) f(t) versus time (s)');
%%%%%%%%%%%%
Y=fft(y)/n; ans =
5.0000
Y'
0.0000 - 0.0000i
0.5000
-0.0000 + 0.5000i
0
-0.0000 - 0.5000i
0.5000
0.0000 + 0.0000i

CE 206: Engg. Computation sessional Dept. of Civil Engg., BUET


Example Problem: DFT
figure(1)
nyquist=fs/2; fmin=1/T;
f=linspace(fmin,nyquist,n/2);
Y(1)=[]; YP=Y(1:n/2);

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')

CE 206: Engg. Computation sessional Dept. of Civil Engg., BUET


Example Problem: DFT

CE 206: Engg. Computation sessional Dept. of Civil Engg., BUET


Power Spectrum
Provides another useful way to discern the underlying harmonics
of seemingly random signals.
In terms of DFT, a power spectrum consists of a plot of power
associated with each frequency component (Pk) 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;

CE 206: Engg. Computation sessional Dept. of Civil Engg., BUET


Example Problem: Wolf Sunspot Number

plot(f,pow)
xlabel('Frequency (cycles/year)'); ylabel('power')
title('Power versus frequency')

CE 206: Engg. Computation sessional Dept. of Civil Engg., BUET

You might also like