dpzplot.m

来自「数字信号处理(机械工业出版社)的源码」· M 代码 · 共 48 行

M
48
字号
function dpzplot(b,a)%DPZPLOT plots the poles and zeros of a discrete-time LTI system.%% Usage:  dpzplot(b,a) %% The LTI system is defined by the coefficients in 'b' and 'a', which% are in the form required by the MATLAB function 'filter'. Namely,% the system function has a numerator polynomial given by the% coefficients in 'b' and a denominator polynomial given by the% coefficients in 'a'.  %---------------------------------------------------------------% copyright 1996, 2001, by John Buck, Michael Daniel, and Andrew Singer.% For use with the textbook "Computer Explorations in Signals and% Systems using MATLAB", Prentice Hall, 1997, 2002.%---------------------------------------------------------------la=length(a);lb=length(b);if (la>lb),  b=[b zeros(1,la-lb)];elseif (lb>la),  a=[a zeros(1,lb-la)];endps = roots(a);zs = roots(b);mx = max( abs([ps' zs' .95]) ) + .05;clf;axis([-mx mx -mx mx]);axis('equal');hold onw = [0:.01:2*pi];plot(cos(w),sin(w),'.');plot([-mx mx],[0 0]);plot([0 0],[-mx mx]);text(0.1,1.1,'Im','sc');text(1.1,.1,'Re','sc');plot(real(ps),imag(ps),'x');plot(real(zs),imag(zs),'o');numz=sum(abs(zs)==0);nump=sum(abs(ps)==0);if numz>1,  text(-.1,-.1,num2str(numz));elseif nump>1,  text(-.1,-.1,num2str(nump));endhold off;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?