Dsp_lab_5
Dsp_lab_5
Introduction:
The e
x(n) = ∫ ( ) d
1. Periodicity: The Discrete Time Fourier Transform (DTFT) of a signal x(n) is periodic in
X ( e jω ) = X ( e j (ω + 2π ))
2. Symmetry: For a real valued signal x(n) , its DTFT X ( e jω ) is a conjugate symmetric.
X ( e jω ) = X * (e jω )
Then
X1( )+ β X2( )
x1(n)+β x2(n) ⟷
Pre-Lab Homework:
Students are supposed to learn about the important properties of DTFT (stated above)
before appearing to lab.
Apparatus:
1. Computer (Desktop/Laptop)
2. MATLAB (at least version 6)
Precautions:
Make sure that all the m-files are saved in the current directory of MATLAB. Otherwise, the m-
files will not be found and executed when they are called from the command window.
Experimental Procedure:
1. Find DTFT of the signal defined by x(n) = (0 .9 exp( jπ / 3))n where 0 ≤n≤10.
2. Verify Linearity property [Assume, x1(n ) and x2(n) be two random
sequences uniformly distributed between [0,1] over 0≤n≤10].
3. Verify Time shif property.
[To verify the time shifting property , generate a random sequence uniformly
distributed between [0,1] over 0 ≤n≤10 and generate another signal y(n)=x(n-2).
Then verify the sample shif property.]
4. Verify Frequency shif property. [To verify the frequency shif property, we
will generate two signals x(n) and y(n) defned by x(n)=cos(πn /2) ,where
0≤n≤100 and
jπ n / 4
y(n)=e x ( n )]
5. Verify Convolution property using the following
signals-x(n)= {1 3 5 7 9 11 13 15 17}
↑
and h(n)={1 -2 3 -2 1}
↑
Magnitude
4
w =(pi/100)*k;
X = x*(exp(-j*pi/100)).^(n'*k);
2
magX = abs(X); angX = angle(X);
subplot(2,1,1); 0
plot(w/pi,magX); -2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2
grid Frequency in pi units
xlabel('Frequency in pi units');
0.5
ylabel('Magnitude');
title('Magnitude Part');
subplot(2,1,2);
plot(w/pi, angX/pi);
Radiansipi
0
grid
xlabel('Frequency in pi units');
ylabel('Radiansipi');
tille('Angle Part'); -0.5
-2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2
Frequency in pi units
20
x2=rand(1,11); % generate random number x2
10
alpha=2;
beta=3; 0
x3=alpha*x1+beta*x2; % generate left side of
-10
property axi(n)+ p x2(n) -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
frequency in pi units
w = -pi:pi/200: pi;
X1=freqz(x1,1,w); % DTFT of xl
X2=freqz(x2,1,w);% DTFT of x2
X3=freqz(x3,1,w);%DTFT of x3
subplot(2,1,1);
plot(w/pi,X3)
xlabel('frequency in pi units');
ylabel('CDTFT of x3');
title('DTFT of "a1pha*xl+betex2');
X_check=alpha*X1+beta*X2; % generate right
side of property ax,(4))+ p X2(w)
error=max(abs(X3-X check)) % check the
difference between left and right side
subplot(2,1,2); plot(w/pi, X check)
xlabel('frequency in pi units');
ylabel('DTFT of X cheek');
title('DTFT of alpha*x1+ beta*DTFT of x2');
3.
x=rand(1,11);%generaterandomnumber w=- 10
pi:pi/250:pi;
X_L=freqz([0 0 x],1,w);
X(w)exp(-jwk)
5
%DTFTofleftpartofequation
subplot(2,1,1) 0
plot(w/pi,abs(X_L))
X= freqz(x,1,w); -5
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
X_R=exp(-j*2*w).*X;%DTFTofrightpartofequation
frequencyinpiunits
subplot(2,1,2)
plot(w/pi, abs(X_R)) 10
subplot(2,1,1);
plot(w/pi, X_L)
DTFT of x(n-k)
5
xlabel('frequencyinpiunits');ylabel('X(w)exp(-
jwk)'); subplot(2,1,2);plot(w/pi,X_R) 0
xlabel('frequency in pi units');
ylabel('DTFT of x(n-k)'); -5
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
frequency in pi units
0
-4 -3 -2 -1 0 1 2 3 4
1. Report should consist of plots, simulation results, and any additional assignment
your instructor might assign to you.
2. Include all the results in chronological manner in the ‘Simulation and
Measurement’ section.
3. Put the corresponding codes in appendix section at the end of the report.
In this lab the using of Discrete Time Fourier Transform in MATLAB was described. The
general concept Discrete Time Fourier Transform was successfully learned and implemented
the code carefully. A mathematical problem was done successfully and the output
Reference(s):