Ss Lab10
Ss Lab10
EQUIPMENT:
IBM compatible computer
MATLAB
DISCUSSION:
Unilateral Z transform
Alternatively, in cases where x[n] is defined only for n ≥ 0, the single-sided or
unilateral Z- transform is defined as
∞
𝑋(𝑍) = ∑ 𝑥[𝑛]𝑍−𝑛
𝑛=0
Bilateral Z-transform
The bilateral or two-sided Z-transform of a discrete-time signal x[n] is the function
X(z) defined as
∞
𝑋(𝑍) = ∑ 𝑥[𝑛]𝑍−𝑛
𝑛=−∞
The z-transform is the discrete-time counter-part of the Laplace transform and a
generalization of the Fourier transform of a sampled signal. The z-transform allows insight into
the transient behavior, the steady state behavior, and the stability of discrete-time
systems. A working knowledge of the z-transform is essential to the study of digital filters and
system
Stability of a system
A system is said to be stable if the poles lie inside of a unit circle on the z-plane.
Z transform
Programs:
Example: 01
syms Z n
a=ztrans(1/16^n)
pretty (a)
Example:02
syms n
f=sin(n);
r=ztrans(f);
disp('z trans using function')
disp(r)
Example:03
Use the following MATLAB code to determine z-transform of the signal
x[n] = [3(2n) – 4(3n)]u[n].
syms n x
x=(3*(2.^n)-4*(3.^n));
F = ztrans(x)
Pretty(F)
POLE ZERO DIAGRAM FOR A FUNCTION IN Z DOMAIN
Example:04
The following example illustrates the use of MATLAB to compute zero and poles of a transfer
function and to plot them onto the z-plane.
Find poles and zeros of the following pulse transfer function and plot them onto the z-plane.
2−z−1
H ( z )=
1−0 . 1 z −1 −0 . 02 z −2
On the z-plane, “x” indicate the poles and “0” indicate the zeros.
Example:05
syms n;
f = ((-1).^n)*2^-n
ztrans(f)
Example:06
z=[0 ]
p=[0.5;-75]
zplane(z,p)
Example:07
Matlab Code:
b=[0 1 1 ]
a= [1 -2 +3]
roots(a)
roots(b)
zplane(b,a);
Example:08
FREQUENCY RESPONSE:
The Freqz function computes and display the frequency response of given Z- Transform of
the function
freqz(b,a,npt,Fs)
b= Coeff. Of Numerator
a= Coeff. Of Denominator
Fs= Sampling Frequency
Npt= no. of free points between and Fs/2
Matlab Code
b=[2 5 9 5 3];
a= [5 45 2 1 1];
freqz(b,a);
Example:09
Plot the magnitude and phase of the frequency response of the given digital filter
Using freqz function:
Y(n) = 0.2x(n) + 0.52y(n-1) – 0.68(y(n-2)
Matlab Code:
b = [0.2];
a= [1, -0.52, 0.68];
w = [0:1:500]*pi/500;
H=freqz(b,a,w);
magH = abs(H);
phaH = angle(H)*180/pi;
subplot(2,1,1);
plot(w/pi,magH);
title('Magnitude Response');
xlabel('frequency ');
ylabel('│H│');
subplot(2,1,2);
plot(w/pi,phaH);
title('Phase Response');
xlabel('frequency');
ylabel('Degrees');
Example:10
Write a program to perform the z transform on user defined sequence
syms z
a=input('input sequence');
x=0;
n=length(a);
for i=1:n;
x=x+a(i)*z^-(i-1); % x=x+a(i)*z^-(i-3) when x[n] starts with n=-2.
end
disp('z-trasnform of the sequence is')
display(x)
Example:11
linearity property
If X(n) and Y(n) having Z-transform X(z) and Y(z) respectively, and and b are arbitrary
constants,
then:
clc;
close all;
clear all;
syms Z n
a1=1/2;
a2=1/2;
f1=n;
f2=n;
display('z-transform of first function')
ft1=a1*f1;
fs1=ztrans(ft1)
display('z-transform of second function')
ft2=a2*f2;
fs2=ztrans(ft2)
display('sum of the first and second s domain function')
fs12=fs1+fs2
display('z-transform of the sum of (first and second) time domain function')
ft=((a1*f1)+(a2*f2));
fs=ztrans(ft)
display('fs12 and fs are same which verifies the property of linearity')
INVERSE Z-TRANSFORM
Syntax
f=izatrans(F)
DESCRIPTION:
f=izatrans(F) is the inverse z-transform of scalar symbolic object F with default independent
variable z. the default return is a function of n.
example:
2z
The following piece of code finds the inverse z-transform of x(n)=
2 z−1
syms z n
iztrans((2*z)/(2*z-1))
(1/2)^n
MATLAB has build-in functions to find the inverse z-transform by using both of the
above methods.
To find inverse z-transform by power series, one may use the built-in function “impz”.
Use on-line help facility of MATLAB to find-out more about this built-in function. That
is, type
help impz
You may also use MATLAB function “filter” for the same purpose.
Following program determines the partial fraction of the following expansion using
‘residuez’funciton
num=[18 0 0 0];
den = [18 3 -4 -1];
[r, p, k] = residuez (num,den);
disp(‘Residues’);
disp(r)
disp(‘Poles’);
disp(p)
disp(‘Constants’);
disp(k)
TASKS:
1:
2:
Compute the impulse response of the given transfer function using dimpulse command
2 . 25−2 .1 z−1 −3. 95 z−2 −1. 6 z−3 −0 .2 z−4
H ( z )=
4−2 . 96 z−1 +0 . 8 z −2 −0 . 1184 z−3 −0 .0064 z −4
Review Questions: