📄 plotpz.m
字号:
function [v,u]=plotpz(num,den,ty)
% PLOTPZ Pole/Zero plot of H(s) or H(z).
%
% [P,Z] = PLOTPZ(NUM,DEN,TY) Plots and returns Pole/Zeros of H = NUM/DEN
% NUM, DEN are coefficients in descending order.
% TY = 's' for H(s)) or TY = 'z' for H(z).
% P reutrns the poles and Z returns the zeros.
%
% PLOTPZ (with no input arguments) invokes the following example:
%
% % Plot Poles/Zeros of H(z) = (z*z-2*z+.5)/[(z+.3)(z*z-z+.5)]
% >>[p,z] = plotpz([1 -2 .5],conv([1 .8],[1 .5 .5]),'z')
% ADSP Toolbox: Version 2.0
% For use with "Analog and Digital Signal Processing", 2nd Ed.
% Published by PWS Publishing Co.
%
% Ashok Ambardar, EE Dept. MTU, Houghton, MI 49931, USA
% http://www.ee.mtu/faculty/akambard.html
% e-mail: akambard@mtu.edu
% Copyright (c) 1998
if nargin==0,help plotpz,disp('Strike a key to see results of the example')
pause,
vx=matverch;
if vx < 4, eval('clg');else,eval('clf');end
[p,z]=plotpz([1 -2 .5],conv([1 .8],[1 .5 .5]),'z'),return,end
vx=matverch;
if nargin<3,ty='s';end
u=roots(num);v=roots(den);
b1=[real(u);real(v)];b2=[imag(u);imag(v)];
x=1.2*max([abs(b1);abs(b2);1]);s=[-x x -x x];
b=3;if exist('version')==5,b=4;end;
if b==3,axis('square');axis(s);end
if ty=='z',ellipse(1,':');hold on,end
if vx < 5, typ='xr';tyz='og';else,typ='rx';tyz='go';end
plot(real(u),imag(u),tyz,real(v),imag(v),typ)
%plot(real(u),imag(u),'oc3',real(v),imag(v),'xc2')
if b==4,axis('square');axis(s);end
if ty=='s',hold on,end,
axesn,hold off;
if b==3,pause,axis('normal');end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -