0% found this document useful (0 votes)
50 views

Digital Signal Processing: Name: Roll No: Aim

The document describes a digital signal processing lab experiment on concepts of the Z-transform. The student was asked to: 1) Use MATLAB to obtain symbolic Z-transforms of various signals. 2) Plot poles and zeros of Z-transforms on the z-plane. 3) Obtain symbolic inverse Z-transforms of signals. 4) Plot pole-zero diagrams and calculate impulse responses of different systems using MATLAB functions. The student provided MATLAB code to carry out each part of the experiment and summarized the key concepts learned about Z-transforms.

Uploaded by

Charmil Gandhi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views

Digital Signal Processing: Name: Roll No: Aim

The document describes a digital signal processing lab experiment on concepts of the Z-transform. The student was asked to: 1) Use MATLAB to obtain symbolic Z-transforms of various signals. 2) Plot poles and zeros of Z-transforms on the z-plane. 3) Obtain symbolic inverse Z-transforms of signals. 4) Plot pole-zero diagrams and calculate impulse responses of different systems using MATLAB functions. The student provided MATLAB code to carry out each part of the experiment and summarized the key concepts learned about Z-transforms.

Uploaded by

Charmil Gandhi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Digital Signal Processing

Lab - 5
Name :​ Charmil Gandhi
Roll No : ​1741059

Aim: ​To understand the various concepts of Z-Transform


-------------------------------------------------------------------------------------------------------------------------------
1. Create a single matlab script and obtain Symbolic Z-Transform of following signals. Use
ztrans command to obtain z-transform and use syms command to construct symbolic
variables. Display output on the command window and take screenshots.
a. X(n)= u(n)
b. X(n)= nu(n)
c. X(n) = (1+n) u(n)
d. X(n) = cos(𝛚​0​𝝅)u(n)
e. X(n) = sin(𝛚​0​𝝅)u(n)
f. X(n) = a​n​cos(𝛚​0​𝝅)u(n)
g.X(n) = a​n​sin(𝛚​0​𝝅)u(n)
h.X(n) = na​n​u(n)
i. X(n) = -na​n​u(-n-1)
j. X(n) = n(-1)​n​u(n)
k.X(n) = (n)​2​u(n)
Code:
clc;
clear;
syms a w n z
k = ​1​;
% heaviside is inbuilt matlab function to generate u[n]
% for k<0, it will give 0, for k=0 it will give 0.5 and for k>0, it will
% give 1
% ------ Signal 1 --------
ztrans(heaviside(k), n, z)

% ------ Signal 2 --------


ztrans(n*heaviside(k), n, z)

% ------ Signal 3 --------


ztrans((​1​+n)*heaviside(k), n, z)

% ------ Signal 4 --------


ztrans(​cos​(w*n)*heaviside(k), n, z)
% ------ Signal 5 --------
ztrans(​sin​(w*n)*heaviside(k), n, z)

% ------ Signal 6 --------


ztrans(a^n*​cos​(w*n)*heaviside(k), n, z)

% ------ Signal 7 --------


ztrans(a^n*​sin​(w*n)*heaviside(k), n, z)

% ------ Signal 8 --------


ztrans(n*a^n*heaviside(k), n, z)

% ------ Signal 9 --------


fn = -(heaviside(k+​1​))
ztrans(-n*a^n*fn, n, z)

% ------ Signal 10 --------


ztrans(n*(​-1​)^n*heaviside(k), n, z)

% ------ Signal 11 --------


ztrans(n^​2​*heaviside(k), n, z)

% ----- Signal 12 ---------


k=​2​;
fn = -(heaviside(k​-1​))
ztrans(fn,n,z)

First I have used the ​syms​ command to create symbolic variables ​a​, ​w​, ​n​ and ​z.​ I have used
heaviside t​ o generate the unit step function which takes ​k​ as input parameter. If ​k>0, I​ t will give
step function with magnitude 1, for ​k=0​, it will give step function with magnitude 0.5. To get the
z-transform, I am using the inbuilt MATLAB function ​ztrans.
2. Plot poles and zeros of the Z-transform obtained for following signals using zplane
command. (Write in single matlab script)
a. X(n) = (1/2)​n​u(n) + (-1/3)​n​u(n)
b. X(n) = (-1/3)​n​u(n) - (1/2)​n​u(-n-1)
c. X(n) = (1/2)​n​u(-n)
d. X(n) = {-1,0,-1,0,-1,0,-1,0,-1.......}
Note: For all the sub questions, poles and zeros were found out on paper and submitted
in lab
Code:
clc;
close all;

poles = [​-1​/​3​;​1​/​2​];
zero = [​0​;​0​];
grid on;
figure(​1​),
zplane(zero,poles);

poles = [​-1​/​3​;​1​/​2​];
zero = [​0​;​1​/​12​];
grid on;
figure(​2​),
zplane(zero,poles);
poles = [​1​/​2​];
zero = [];
grid on;
figure(​3​),
zplane(zero,poles);

poles = [​-1​;​1​];
zero = [​0​];
grid on;
figure(​4​),
zplane(zero,poles);

For each subquestion, I have made different arrays of poles and zeros which were found out on
paper calculation. I have used ​zplane​ command to plot the zeros and poles.
3. Create a single matlab script and obtain Symbolic Inverse Z-Transform of following
signals using iztrans command and use syms command to construct symbolic variables.
Display output on the command window and take screenshots.
a. X(z) = (1 + 3z −1 )/(1 − 3z −1 + 2z − 1 )
b. X(z) =( 1 + 2z −1 /1 + z −2 )
c. X(z) =( 1/(1 − z −1 )2 (1 − 2z −1 ) )
Note: All the inverse z-transforms have been calculated on paper before and submitted
Code:
syms z
% ------ Signal 1 -----------
x1 = iztrans((​1​+​3​*z^(​-1​))/(​1-3​*z^(​-1​)+​2​*z^(​-2​))) ​% finding inverse z
transform

% ------ Signal 2 -----------


x2 = iztrans((​1​+​2​*z^(​-1​))/(​1​+z^(​-2​))) ​% finding inverse z
transform

% ------ Signal 3 -----------


x3 = iztrans(​1​/(((​1​-z^(​-1​))^​2​)*(​1-2​*z^(​-1​)))) ​% finding inverse z
transform

display(x1);
display(x2);
display(x3);

First I have used the ​syms​ command to create symbolic variable ​z. ​To find the inverse z
​ nd using the ​display​ ​function to
transform, I have used the inbuilt MATLAB function ​iztrans a
display the result on the command window.
4. Plot poles and zeros of the Z-transform obtained for following signals using zplane
command. Also obtain the impulse response of the following system using impz
command. Take impulse response length n = 16 to plot impulse response. Create a
matlab script of each one of the following systems to obtain pole-zero plot and impulse
response.

a. Y(n) = 0.75 y(n-1) – 0.125 y(n-2) +x(n)


Code:
clc;
clear all;

zero = [​0​;​0​];
poles = [​1​/​2​;​1​/​4​];
figure;
zplane(zero,poles);
z = [​1​]
p = [​1​ ​-0.75​ ​0.125​]
n=​16​;
figure;
impz(z,p,n);

I have created the array of zeros and poles and used the ​zplane​ function to plot them. I
have generated another 2 arrays which have coefficients (​z ​and ​p)​ . To generate the
impulse response, I have used the inbuilt MATLAB function ​impz​ for n=16 which is the
impulse response length.
b. Y(n) = y(n-1)+x(n)
Code:
clc;
clear all;

zero = [​0​];
poles = [​1​];
figure;
zplane(zero,poles);
z = [​1​]
p = [​1​ ​-1​]
n=​16​;
figure;
impz(z,p,n);
I have created the array of zeros and poles and used the ​zplane​ function to plot them. I
have generated another 2 arrays which have coefficients(​z ​and ​p​). To generate the
impulse response, I have used the inbuilt MATLAB function ​impz​ for n=16 which is the
impulse response length.
c. Y(n)= 0.7 y(n-1) - 0.1 y(n-2) + 2 x(n) – x(n-2)
Code:
clc;
clear all;

z = [​0.707​; ​-0.707​];
p = [​1​/​5​;​1​/​2​];
figure;
zplane(z,p);
z = [​2​ ​0​ ​-1​]
p = [​1​ ​-0.7​ ​0.1​]
n=​16​;
figure;
impz(z,p,n);
I have created the array of zeros and poles and used the ​zplane​ function to plot them. I
have generated another 2 arrays which have coefficients(​z ​and ​p​). To generate the
impulse response, I have used the inbuilt MATLAB function ​impz​ for n=16 which is the
impulse response length.

Conclusion:
In this lab, we understood various concepts of z-transform, methods to find z-transform,
poles-zeros plot.

You might also like