jump to navigation

Z-plane and its responses using Matlab December 14, 2008

Posted by haryoktav in Taipei.

If you want to plot z-plane in Matlab, just use zplane command. This example is taken from example 5.10 from textbook “Discrete-time Signal Processing 2nd Ed, Oppenheim”


z = [-1  exp(1.0376j) exp(-1.0376j)]';                        % zeros
p = [0.683 0.892*exp(0.6257j) 0.892*exp(-0.6257j)]';    % poles
k = 0.05634;                                                        % gain
zplane(z,p);        % plot z-plane

And now, this is how to plot magnitude respons, phase response and group delay.

% -----------------------------------------------
% Frequency response
% -----------------------------------------------
[b a] = zp2tf(z,p,k);			% Zero-pole to transfer function conversion
[h, w] = freqz(b,a,N);			% Digital filter frequency response

figure(1);subplot(131);plot(w/pi,abs(h));		% plot magnitude
title('Magnitude response');
xlabel('Normalized freq. (Nyquist freq. = 1)')
ylabel('response magnitude');

figure(1);subplot(132);plot(w/pi,angle(h));	% plot angle
title('Phase response');
xlabel('Normalized freq.(Nyquist freq. = 1)')
ylabel('phase (rad/sec)');

% -----------------------------------------------
% Group delay
% -----------------------------------------------
[gd, w] = grpdelay(b,a);		%Group delay of a digital filter

figure(1);subplot(133);plot(w/pi,gd);	% plot group delay
title('Group delay');
xlabel('Normalized freq. (Nyquist freq. = 1)')
ylabel('delay (in samples)');


That figure is plotted from 0 to pi. I dunno how to plot from -pi to pi, or from 0 to 2pi. Overall, that was a nice figure, isn’t it?


1. maciek - December 5, 2012

To plot from 0 to 2pi just type
[h, w] = freqz(b,a,’whole’);

haryoktav - December 6, 2012

#maciek: nice, thx!

2. santosh - January 11, 2013

please provide a method to convert the z plane poles to s plane

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: