function dpzplot(b,a)
% dpzplot(b,a)
% Plots the pole-zero diagram for the discrete-time system function
% H(z)=b(z)/a(z) defined by numerator and denominator polynomials b and a.
la=length(a);
lb=length(b);
if (la>lb),
b= [b zeros(1,la-lb)] ;
elseif (lb>la),
a= [a zeros(1,lb-la)] ;
end
ps = roots(a) ;
zs = roots(b) ;
mx = max(abs([ps' zs' .95]))+0.05;
clf
axis ([-mx mx -mx mx]);
axis('equal');
hold on
w=[0: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(l.l,0.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>l,
text(-0.1,-0.1,num2str(numz));
elseif nump>l,
text(-0.1,-0.1,num2str(nump));
end
hold off ;
:irritated:
error:when running m-file:
??? Input argument "a" is undefined.
Error in ==> dpzplot at 5
la=length(a);
what should i do?


Sign In
Create Account

Back to top









