Dsip Experiment 4
Dsip Experiment 4
Experiment No. 4
Grade: AA / AB / BB / BC / CC / CD /DD
Title: Compute DFT & IDFT of discrete time signals using Matlab.
Objective: To learn & understand the Fourier transform operations on discrete time
signals.
CO Outcome
1. http://www.mathworks.com/support/
2. www.math.mtu.edu/~msgocken/intro/intro.html
3. www.mccormick.northwestern.edu/docs/efirst/matlab.pdf
4. A.Nagoor Kani “Digital Signal Processing”, 2nd Edition, TMH Education.
The sequence f(n) can be calculated from F(k) using the Inverse Discrete Fourier
Transform (IDFT):
Annex A shows that the IDFT defined above really is an inverse DFT.
Conventionally, the sequences f(n) and F(k) is referred to as 'time domain' data and
'frequency domain' data respectively. Of course there is no reason why the samples in
f(n) need be samples of a time dependent signal. For example, they could be spatial
image samples (though in such cases a 2 dimensional set would be more common).
Although we have stated that both n and k range over 0..N-1, the definitions above have
a periodicity of N:
So both f(n) and F(k) are defined for all (integral) n and k respectively, but we only need
to calculate values in the range 0..N-1. Any other points can be obtained using the above
periodicity property.
For the sake of simplicity, when considering various Fast Fourier Transform (FFT)
algorithms, we shall ignore the scaling factors and simply define the FFT and Inverse
FFT (IFFT) like this:
In fact, we shall only consider the FFT algorithms in detail. The inverse FFT (IFFT) is
easily obtained from the FFT.
1 point DFT:
2 point DFT:
4 point DFT:
3 point DFT:
Note that each of the matrix multipliers can be inverted by conjugating the elements.
This what we would expect, given that the only difference between the DFT and IDFT
is the sign of the complex exponential argument.
If..
This is the 'Delta Function'. The usual implied periodicity has been made explicit by
using MOD N. The DFT is therefore:
This gives us the DFT of a unit impulse at n=n0. Less obvious is this DFT:
If..
Code:
%DFT
magnitude=abs(res);
disp("DFT Magnitude");
disp(magnitude);
t=0:ln-1;
subplot(222);
stem(t,magnitude);
title('Plotting magnitude response using DFT');
ylabel ('Amplitude');
xlabel ('X');
phase=angle(res);
disp("DFT Phase");
disp(phase);
t=0:ln-1;
subplot(223);
stem(t,phase);
title('Plotting magnitude sequence');
ylabel ('Phase');
xlabel ('X');
%IDFT
res1 =[];
for x=0:N-1
sum=0;
for a=1:N
sum=sum+res(a)*exp(1j*2*pi*(a-1)*x/N);
end
sum=sum/N;
res1 = [res1 sum];
end
disp("IDFT");
disp(res1);
t=0:ln-1;
subplot(224);
stem(t,res1);
title('IDFT Response');
ylabel ('Amplitude');
xlabel ('Time Index');
output :
c. Complex conjugate
x’(n) ⇔ X’((−k)
modN)
d. Circular Convolution
Property x (n) ∗ h (n) ⇔ X
(k) H (k)
e. Multiplication property
x(n)h(n)⇔ (1/N)X(k)∗H(k)
f. Parseval’s Theorem
Symmetry
Ans.
Let us take two finite duration sequences x1(n) and x2(n), having integer length
as N.
Their DFTs are X1(K) and X2(K) respectively, which is shown below −
X1(K)=∑n=0N−1x1(n)ej2ΠknN k=0,1,2...N−1X1(K)=∑n=0N−1
x1(n)ej2ΠknNk=0,1,2...N−1
X2(K)=∑n=0N−1x2(n)ej2ΠknNk=0,1,2...N−1
X2(K)=∑n=0N−1x2(n)ej2ΠknNk=0,1,2...N−1
Now, we will try to find the DFT of another sequence x3(n), which is given as
X3(K)
X3(K)=X1(K)×X2(K)X3(K)=X1(K)×X2(K)
x3(n)=1N∑n=0N−1X3(K)ej2ΠknNx3(n)=1N∑n=0N−1X3(K)ej2Πk
nN
x3(n)=∑m=0N−1x1(m)x2[((n−m))N] m=0,1,2...N−1
Page