Digital Signal Processing: Name: Roll No: Aim
Digital Signal Processing: Name: Roll No: Aim
Lab - 5
Name : Charmil Gandhi
Roll No : 1741059
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)nu(n) + (-1/3)nu(n)
b. X(n) = (-1/3)nu(n) - (1/2)nu(-n-1)
c. X(n) = (1/2)nu(-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
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.
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.