You are on page 1of 5

DIGITAL SIGNAL PROCESSING (TE-321) SSUET/QR/114

--------------------------LAB 06----------------------
ANALYSIS OF DISCRETE FOURIER
TRANSFORM PROPERTIES
Objective ;
 To examine the Discrete Fourier Transform properties using MATLAB.
LAB EXERCISE TASKS
Task # 1:
Write a script in MATLAB for using two Discrete time Signals xn1 = n/4 and xn2 =
cos(3*pi*n/8) with a = 0.8 & b = 0.1 are the amplitude integrals to verify the linearity property of
Discrete Fourier Transform.
SOLUTION:
MATLAB CODE:
%TO VERIFY LINEARTITY PROPERTY
%dft[a*x1+bx2]=aX1+bX2
a=0.8; b=0.1; n=[0:5]; x1=n/4; x2=cos(3*pi*n/8);
X1=fft(x1);
X2=fft(x2);
LHS=fft(a*x1+b*x2)
RHS=a*X1+b*X2
OUTPUT:
LHS =

3.0676 + 0.0000i -0.3069 + 1.1473i -0.6224 + 0.3320i -0.6090 + 0.0000i -0.6224 - 0.3320i -0.3069 - 1.1473i

RHS =

3.0676 + 0.0000i -0.3069 + 1.1473i -0.6224 + 0.3320i -0.6090 + 0.0000i -0.6224 - 0.3320i -0.3069 - 1.1473i

Task # 2:Write a script in MATLAB for using a Discrete time Signals xn=[1 3 2 -1] to prove the
time reversal property of Discrete Fourier Transform.
SOLUTION:
MATLAB CODE:
%TO PROVE TIME REVERSAL PROPERTY
%F[x(-m)]=e^-jm0wX(e^jw)
x1=[1 3 2 -1]
x2=[1 -1 2 3]
LHS=fft(x1)
RHS=fft(x2)
OUTPUT:
LHS =
5.0000 + 0.0000i -1.0000 - 4.0000i 1.0000 + 0.0000i -1.0000 + 4.0000i
RHS =

5.0000 + 0.0000i -1.0000 + 4.0000i 1.0000 + 0.0000i -1.0000 - 4.0000i

DEPARTMENT OF TELECOMMUNICATION ENGINEERING


SIR SYED UNIVERSITY OF ENGINEERING & TECHNOLOGY, KARACHI
DIGITAL SIGNAL PROCESSING (TE-321) SSUET/QR/114

Task # 3:Write a script in MATLAB, considering a Discrete time Signals xn=[1 2 3 4] and it
delayed by 2 sample points, use this DTS to prove the time shifting property of Discrete Fourier
Transform.
SOLUTION:
MATLABCODE:
%TO PROVE TIME SHIFTING PROPERTY
x=[1 2 3 4] ;
n=input('Enter the delay integer');
x1=length(x);
xn=x1+n;
for i=1:xn;
if(i<=n)
xn0(i)=0;
else
xn0(i)=x(i-n);
end;
end;

subplot(2,1,1);
stem(x);
title('Input sequence');
xlabel('time index');
ylabel('amplitude');
subplot(2,1,2);
stem(xn0);
title('delayed sequence');
xlabel('time index');
ylabel('amplitude');
figure;
w=0:pi/xn:pi*(xn-1)/xn;
X=fft(x,length(w));
Xn0=fft(xn0,length(w));
s=exp(-j*w*n).*X;
subplot(2,1,1);
stem(abs(Xn0));
title('DFT of the delayed sequence');
xlabel('time index');
ylabel('amplitude');
subplot(2,1,2);
stem(abs(s));
title('DFT of the original sequence*(e^-j*w*n)');
xlabel('time index');
ylabel('amplitude');

OUTPUT:

DEPARTMENT OF TELECOMMUNICATION ENGINEERING


SIR SYED UNIVERSITY OF ENGINEERING & TECHNOLOGY, KARACHI
DIGITAL SIGNAL PROCESSING (TE-321) SSUET/QR/114

Task # 4: Write a script in MATLAB for using a DTS xn=[5 0 -3 4] to prove the Parseval’s property
of Discrete Fourier Transform.
SOLUTION:
MATLAB CODE:
%TO PROVE TIME PARSAVAL THEORAM
n = 1:10;
x = [ 5 0 -3 4];
xmod = abs(x);
xmodsquared = xmod. ^2;
energy left = sum(xmodsquared)
N = length(x);
f = fft(x,N);
fmod = abs(f);
fmodsquared = fmod.^2;
energy right = sum(fmodsquared)/N
stem(energy_right,energy_left)
xlabel('Right Energy')
ylabel('Left Energy')

OUTPUT:

DEPARTMENT OF TELECOMMUNICATION ENGINEERING


SIR SYED UNIVERSITY OF ENGINEERING & TECHNOLOGY, KARACHI
DIGITAL SIGNAL PROCESSING (TE-321) SSUET/QR/114

energy_left =50
energy_right = 50.0000

Task # 5: Write a script in MATLAB to prove the circular convolution theorem in terms of two
discrete signals.
a) With using cconv command.
SOLUTION:
MATLAB CODE:
%CIRCULAR CONVOLUTION
x1= [1 2 2 1];
x2= [1 2 3 4];
c=cconv(x1,conj(fliplr(x2)),4)
OUTPUT:
c = 13 15 17 15
b) Without using cconv command.
SOLUTION:
MATLABCODE:
g=[1 2 2 1];
h=[1 2 3 4];
N1=length(g);
N2=length(h);
N=max(N1,N2);
N3=N1-N2;
if(N3>0)
h=[h,zeros(1,N3)];
else
g=[g,zeros(1,-N3)];
end
for n=1:N;
y(n)=0;
for i=1:N;
j=n-i+1;
if(j<=0)
j=N+j;
end

DEPARTMENT OF TELECOMMUNICATION ENGINEERING


SIR SYED UNIVERSITY OF ENGINEERING & TECHNOLOGY, KARACHI
DIGITAL SIGNAL PROCESSING (TE-321) SSUET/QR/114

y(n)=[y(n)+(g(i)*h(j))];
end
end
disp('The resultant is');y
subplot(2,1,1);
stem(y);
xlabel('N->');
ylabel('Amplititude->');
OUTPUT:
y =17 15 13 15

Conclusion

So, in this lab, we demonstrate the time reversal, time shifting, linearity, Parseval theorem, and circular
convolution of the Fourier transform.

Teacher’s Signature: _________________

DEPARTMENT OF TELECOMMUNICATION ENGINEERING


SIR SYED UNIVERSITY OF ENGINEERING & TECHNOLOGY, KARACHI

You might also like