You are on page 1of 11

International Islamic University Chittagong

Dept. of Electrical and Electronic Engineering

Experiment-7
Frequency domain analysis of DT signals

EEE-3604 Digital Signal Processing Sessional

Prepared By
Mohammed Abdul Kader
Assistant Professor, Dept. of EEE, IIUC
Objectives

a) To understand the mathematics of transforming a signal from time domain to frequency


domain.
b) To transform a signal from time domain to frequency domain by DFT in MATLAB.
c) To transform a signal from time domain to frequency domain by FFT in MATLAB.

2 Experiment-7, Digital Signal Processing Sessional, Prepared By- Mohammed Abdul Kader, Assistant Prof, Dept. of EEE, IIUC
Time domain and Frequency domain Representation of Signal

Amplitude
x(t)
The variation of amplitude with time

Time

Amplitude
X(ω)
Amplitude of signals in various
frequency components
10 25 30

Frequency

3 Experiment-7, Digital Signal Processing Sessional, Prepared By- Mohammed Abdul Kader, Assistant Prof, Dept. of EEE, IIUC
Concept of converting time domain to frequency domain

𝑥 𝑛 = 𝐴0 + 𝐴𝑛 cos 𝜔𝑛 + 𝐵𝑛 sin 𝜔𝑛
x(n)

𝑥 𝑛 cos 𝜔0 𝑛 𝑥 𝑛 sin 𝜔0 𝑛
𝐜𝐨𝐬 𝝎𝒏 − 𝒋 𝐬𝐢𝐧 𝝎𝒏
𝑥 𝑛 cos 𝜔1 𝑛 𝑥 𝑛 sin 𝜔1 𝑛

𝑥 𝑛 cos 𝜔𝑁 𝑛 𝑥 𝑛 sin 𝜔𝑁 𝑛
𝒆−𝒋𝝎𝒏

𝑋 𝜔 = 𝑥(𝑛)𝑒 −𝑗𝜔𝑛
𝑛=−∞
4 Experiment-7, Digital Signal Processing Sessional, Prepared By- Mohammed Abdul Kader, Assistant Prof, Dept. of EEE, IIUC
Fourier Transform of Discrete Time Signal

+∞ 𝑁−1
2𝜋𝑛𝑘
−𝑗
𝑋 𝜔 = 𝑥(𝑛)𝑒 −𝑗𝜔𝑛 𝑋 𝑘 = 𝑥(𝑛)𝑒 𝑁
𝑛=−∞ 𝑛=0
2𝜋𝑘
In DTFT frequency domain (𝜔) is continuous. In DFT frequency domain (𝜔 = 𝑁 ) is discrete.
𝜔 changes from 0 to 2𝜋, but it is continuous. 𝜔 changes from 0 to 2𝜋 taking 0 to (N-1) number of samples.

Angular Frequency
0 to 2𝜋
(−𝜋 to 𝜋)
𝐹𝑠 𝐹
(− to + 𝑠 )
2 2

5 Experiment-7, Digital Signal Processing Sessional, Prepared By- Mohammed Abdul Kader, Assistant Prof, Dept. of EEE, IIUC
Fourier Transform of Discrete Time Signal

𝑊𝑁0 𝑊𝑁0 𝑊𝑁0 𝑊𝑁0


𝑁−1 𝑊𝑁0 𝑊𝑁1 𝑊𝑁2 ⋯ 𝑊𝑁𝑁−1
2𝜋𝑛𝑘 2𝜋𝑛𝑘
−𝑗 𝑁
−𝑗 𝑒 = 𝑊𝑁𝑛𝑘 = 𝑊𝑁0 𝑊𝑁2 𝑊𝑁4 2(𝑁−1)
𝑋 𝑘 = 𝑥(𝑛)𝑒 𝑁 𝑊𝑁
⋮ ⋱ ⋮
𝑛=0 (𝑁−1) 2(𝑁−1) (𝑁−1)(𝑁−1)
𝑊𝑁0 𝑊𝑁 𝑊𝑁 ⋯ 𝑊𝑁
n= 0 to N-1 and k= 0 to N-1

𝑋0 1 1 1 . . 1 𝑥(0)
𝑋1 1 𝑊𝑁1 𝑊𝑁2 . . 𝑊𝑁𝑁−1 𝑥(1)
𝑋2 2(𝑁−1)
1 𝑊𝑁2 𝑊𝑁4 . . 𝑊𝑁 𝑥(2)
𝑋3 =
. . . . . . .
.
. . . . . . .
. 2(𝑁−1) (𝑁−1)(𝑁−1)
1 𝑊𝑁𝑁−1 𝑊𝑁 . . 𝑊𝑁 𝑥(𝑁 − 1)
𝑋(𝑁 − 1)

6 Experiment-7, Digital Signal Processing Sessional, Prepared By- Mohammed Abdul Kader, Assistant Prof, Dept. of EEE, IIUC
clc
clear all
T=0.005;
t=0:T:1; Defining Signal
Fs=1/T;
x=sin(2*pi*50*t);
N=length(x);
E=exp(-i*2*pi/N); Transformation Matrix
for k= 1:N
for n=1:N 2𝜋𝑛𝑘 2𝜋
−𝑗 𝑁 −𝑗 𝑁 𝑛𝑘
𝑒 = (𝑒 ) = 𝐸 𝑛𝑘
TM(n,k)=E^((n-1)*(k-1));
end 𝐾
X(k) 𝑓𝑘 = 𝐹
end 𝑁 𝑠
dft=x*TM; DFT Operation
subplot(211);
plot(t,x);
subplot(212); Plotting Time-domain and
%plot(0:N-1,abs(dft)); frequency-domain Signal 0 1 2 3 4 N-2 N-1
plot((0:N-1)*(Fs/N),abs(dft)); k

7 Experiment-7, Digital Signal Processing Sessional, Prepared By- Mohammed Abdul Kader, Assistant Prof, Dept. of EEE, IIUC
Fast Fourier Transform (FFT)
𝑋0 1 1 1 . . 1 𝑥(0)
𝑋1 1 𝑊𝑁1 𝑊𝑁2 . . 𝑊𝑁𝑁−1 𝑥(1)
𝑋2 2(𝑁−1)
1 𝑊𝑁2 𝑊𝑁4 . . 𝑊𝑁 𝑥(2)
𝑋3 =
. . . . . . .
.
. . . . . . .
. 2(𝑁−1) (𝑁−1)(𝑁−1)
1 𝑊𝑁𝑁−1 𝑊𝑁 . . 𝑊𝑁 𝑥(𝑁 − 1)
𝑋(𝑁 − 1)

The N-point DFT values can be computed in a total of 𝑁 2 multiplications and N(N-1) complex additions.
A Fast Fourier Transform (FFT) is an efficient algorithm to compute the Discrete Fourier Transform (DFT) and inverse of DFT. FFT
requires a smaller number of arithmetic operations such as multiplications and addition than DFT (i.e. FFT requires lesser computation
time than DFT).
No of computations in direct DFT Computations in FFT

Multiplications: 𝑁 2 𝑁
Multiplications: 2 𝑙𝑜𝑔2 (𝑁)
Additions: N(N-1)
Additions: 𝑁 𝑙𝑜𝑔2 (𝑁)

8
Experiment-7, Digital Signal Processing Sessional, Prepared By- Mohammed Abdul Kader, Assistant Prof, Dept. of EEE, IIUC
Comparison of Computational Complexity for the Direct Computation of the DFT Versus
the FFT Algorithm

9 Experiment-7, Digital Signal Processing Sessional, Prepared By- Mohammed Abdul Kader, Assistant Prof, Dept. of EEE, IIUC
Fast Fourier Transform (FFT)
plot(n,y3);
Fs=1000; % sampling frequency title('Sinwave 3')
Ts=1/Fs; % sampling period or time step subplot(3,3,[4 5 6]);
n=0:Ts:1-Ts %signal duration plot(n,y);
f1=9; title('Time domain signal (sum of all sin waves)')
f2=39; ny=length(y);
f3=25; N=2^nextpow2(ny);
y1=10*sin(2*pi*f1*n); yfft=fft(y,N);
y2=10*sin(2*pi*f2*n); yfft2=yfft(1:N/2);
y3=10*sin(2*pi*f3*n); xfft=Fs*(0:N/2-1)/N;
y=y1+y2+y3; s5=subplot(3,3,[7 8 9]);
s1=subplot(3,3,1); plot(s5,xfft,abs(yfft2)/max(abs(yfft2)));
plot(s1,n,y1,'b') s5.FontSize = 10;
title(s1,'Sinwave 1') s5.XColor = 'r';
subplot(3,3,2); title(s5,'Frequency domain Signal')
plot(n,y2); grid(s5,'on')
title('Sinwave 2')
subplot(3,3,3);

10
Experiment-7, Digital Signal Processing Sessional, Prepared By- Mohammed Abdul Kader, Assistant Prof, Dept. of EEE, IIUC
11
Experiment-7, Digital Signal Processing Sessional, Prepared By- Mohammed Abdul Kader, Assistant Prof, Dept. of EEE, IIUC

You might also like