These examples show how to use the inverse a Z transform.
1.13.1 example 1
Problem: Given
\[ F\left (z\right ) =\frac {z}{z-1}\]
find
\(x[n]=F^{-1}\left (z\right )\) which is the inverse Ztransform.
Mathematica
Clear["Global`*"];
x[n_]:= InverseZTransform[z/(z-1),z,n]
ListPlot[Table[{n,x[n]},{n,0,10}],
Frame->True,
FrameLabel->{{"x[n]",None},
{"n","Inverse Ztransform of z/(z-1)"}},
FormatType->StandardForm,
RotateLabel->False,
Filling->Axis,
FillingStyle->Red,
PlotRange->{Automatic,{0,1.3}},
PlotMarkers->{Automatic,12}]
|
|
Matlab
function e19()
nSamples = 10;
z = tf('z');
h = z/(z-1);
[num,den] = tfdata(h,'v');
[delta,~] = impseq(0,0,nSamples);
xn = filter(num,den,delta);
stem(xn);
title('Inverse Z transform of z/(z-1)');
xlabel('n'); ylabel('x[n]');
ylim([0 1.3]);
set(gcf,'Position',[10,10,400,400]);
end
%function from Signal Processing by Proakis
%corrected a little by me for newer matlab version
function [x,n] = impseq(n0,n1,n2)
% Generates x(n) = delta(n-n0); n1 <= n,n0 <= n2
% ----------------------------------------------
% [x,n] = impseq(n0,n1,n2)
%
if ((n0 < n1) || (n0 > n2) || (n1 > n2))
error('arguments must satisfy n1 <= n0 <= n2')
end
n = n1:n2;
x = (n-n0) == 0;
end
|
|
1.13.2 example 2
Problem: Given
\[ F\left ( z\right ) =\frac {5z}{\left ( z-1\right ) ^{2}}\]
find
\(x[n]=F^{-1}\left ( z\right ) \)
In Mathematica analytical expression of the inverse Z transform can be generated as well
as shown below
Mathematica
Clear["Global`*"];
x[n_]:= InverseZTransform[(5 z)/(z-1)^2,z,n];
ListPlot[Table[{n,x[n]},{n,0,10}],
Frame->True,
FrameLabel->{{"x[n]",None},
{"n","Inverse Ztransform of (5 z)/(z-1)^2"}},
FormatType->StandardForm,
RotateLabel->False,
Filling->Axis,
FillingStyle->Red,
PlotRange->{Automatic,{0,60}},
PlotMarkers->{Automatic,12},
ImageSize->350]
|
|
Matlab
function e19_2()
nSamples = 10;
z = tf('z');
h = (5*z)/(z-1)^2;
[num,den] = tfdata(h,'v');
[delta,~] = impseq(0,0,nSamples);
xn = filter(num,den,delta);
stem(xn);
title('Inverse Z transform of 5z/(z-1)^2');
xlabel('n'); ylabel('x[n]');
ylim([0 60]);
set(gcf,'Position',[10,10,400,400]);
end
|
|