Professional Documents
Culture Documents
Faculty of Engineering
Laboratory Report Cover Sheet
Students must complete all details except the faculty use part.
Please submit all reports to your subject supervisor or the office of the concerned faculty.
Individual Group
Group Number (if applicable): Submission Submission
Student
No. Student Name Student Number Signature Date
Submitted by:
Group Members:
2
3
4
5
Faculty comments__________________________________________________________________________
Simulation:
PROBLEM MATLAB CODE OUTPUT
1. Find 1. clc;
DTFT of n = 0:10; x =
the signal (0.9*exp(j*pi/3)).^n; k =
defined by -200:200;
x(n) = (0 .9 w =(pi/100)*k;
exp( jπ / X = x*(exp(-
j*pi/100)).^(n'*k);
3))n where
magX = abs(X); angX =
0 ≤n≤10. angle(X);
subplot(2,1,1);
plot(w/pi, magX);
grid
xlabel('frequency in pi
units');
ylabel('Magnitude');
title('Magnitude Part');
subplot(2,1,2);
plot(w/pi, angX/pi);
grid
Alternative
way to find clc;
DTFT of a clc;
signal x(n) n=0:10;
x=(0.9*exp(i*pi/3)).^n;
w=-2*pi:pi/100:2*pi;
X=freqz(x,1,w)
plot(w,X)
grid on;
2. Verify clc;
Linearity x1=rand(1,11); % generate
property random number x1
x2=rand(1,11); % generate
[Assume, random number x2
x1(n ) and alpha=2;
x2(n) be beta=3;
two random x3=alpha*x1+beta*x2; %
sequences generate left side of
uniformly property ?x1(n)+ ? x2(n)
distributed w = -pi:pi/200: pi;
between X1=freqz(x1,1,w); % DTFT
of x1
[0,1] over
X2=freqz(x2,1,w) ;% DTFT
0≤n≤10]. of x2
X3=freqz(x3,1,w) ;% DTFT
of x3
subplot(2,1,1);
plot(w/pi,X3)
xlabel('frequency in pi
units');
ylabel('DTFT of x3');
title('DTFT of
"alpha*x1+beta*x2"');
X_check=alpha*X1+beta*X2;
% generate right side of
property ?X1(m)+ ? X2(m)
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
_check');
title('DTFT of alpha*x1+
beta*DTFT of x2');
3. Verify clc;
Time shift x=rand(1,11); %generate
property. randomnumber
w=-pi:pi/250:pi;
[To verify
X_L= freqz([0 0 x],1,w);
the time %DTFT of left part of
shifting equation
property , subplot(2,1,1)
generate a plot(w/pi, abs(X_L))
random xlabel('frequency in pi
sequence units');
uniformly ylabel('DTFT of x(nk)');
X= freqz(x,1,w);
distributed
X_R= exp(-j*2*w).*X;
between %DTFT of right part of
[0,1] over 0 equation
≤n≤10 and subplot(2,1,2)
generate plot(w/pi, abs(X_R))
another xlabel('frequency in pi
signal units');
y(n)=x(n-2). ylabel('X(w)exp(-jwk)');
Then verify
the sample
shift
property.]
4. Verify n=0:100;
Frequency x=cos(pi*n/2); % Generate
shift signal x
w=-pi:pi/100:pi;
property. X=freqz(x,1,w); % DTFT of
[To verify x
the subplot(211)
frequency plot(w,abs(X))
shift title(' DTFT of signal vs
property, frequency')
we will y=exp(j*pi*n/4).*x
generate %generate y(n)
Y=freqz(y,1,w) % DTFT of
two signals
y(n)
x(n) and subplot(212)
y(n) defined plot(w,abs(Y)) % plot it
by title('Frequency shift
x(n)=cos(πn due to multiplying
/2) ,where exp(jwn)')
0≤n≤100
and y ( n ) =
e jπ n / 4 x (
n )]
5. Verify clc;
Convolution w=-pi:pi/256:pi;
property x=[1 3 5 7 9 11 13 15
17];
using the
h=[1 -2 3 -2 1];
following X=freqz(x,1,w); % This is
signalsx(n)= an alternative way to
{1 3 5 7 9 find DTFT of x1(n)
11 13 15 H=freqz(h,1,w); % DTFT of
17} ↑ and x2(n)
h(n)={1 -2 XP=X.*H;
3 -2 1} subplot(221)
plot(w/pi,abs(XP))
title('Product of
magnitude spectrum') %
find the convolution of
x1(n) and x2(n)
subplot(222)
plot(w/pi,angle(XP))
title('Phase spectum')
y=conv(x,h);
Y=freqz(y,1,w);
subplot(223)
plot(w/pi,abs(Y))
title('Magnitude spectrum
of convoled sequence')
subplot(224)
plot(w/pi,angle(Y))
title(' Phase of
convolved sequence')
Reference(s):
1.John G. Proakis & Dimitris G. Manolakis, “Digital Signal Processing – Principles,
Algorithms and Applications”, Prentice – Hall India, 3rd Edition.