⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 plotpz.m

📁 高阶sigma-delta调制器设计matlab工具包, 半波带滤波器设计工具包
💻 M
字号:
function plotPZ(H,color,markersize,list)%function plotPZ(H,color='b',markersize=5,list=0)%Plot the poles and zeros of a transfer function.%If list is non-zero, a list of the poles and zeros is superimposed on the plot.if nargin < 4    list = 0;    if nargin < 3	markersize = 5;	if nargin <2	    color = 'b';	end    endendif iscell(color)    pole_fmt = [color{1} 'x'];    zero_fmt = [color{end} 's'];else    pole_fmt = [color 'x'];    zero_fmt = [color 's'];endif isobject(H) & strcmp(class(H),'zpk')    z = H.z{:};    p = H.p{:};elseif strcmp(H.form,'coeff')    z = roots(H.num);    p = roots(H.den);elseif strcmp(H.form,'zp')    z = H.zeros;    p = H.poles;else    fprintf(1,'%s: form of H is unsupported.\n', mfilename);    returnend% Plot x and o for poles and zeros, respectivelypp = plot(real(p),imag(p),pole_fmt);set(pp,'markersize',markersize);if ~isempty(z)    hold_status = ishold;    if ~hold_status; hold on; end;    zz = plot(real(z),imag(z),zero_fmt);    set(zz,'markersize',markersize);    if ~hold_status; hold off; end;end% Draw unit circle, real axis and imag axishold_status = ishold;hold onplot(exp(j*2*pi*(0:0.01:1)));axis('equal');set(gcf,'MenuBar','none'); set(gcf,'NumberTitle','off'); set(gcf,'Name','PZ');limits = axis;plot([0 0],limits(3:4),'k:',limits(1:2),[0 0],'k:')if list% List the poles and zeros    p = cplxpair(p);    y = 0.05*(ceil(length(p)/2)+1);    str = 'Poles:               ';    text( 0, y, str, 'Hor', 'Right', 'Ver', 'Mid'); y = y - 0.1;    for i = 1:2:length(p);	if abs(imag(p(i))) < 1e-6	    str = sprintf('%+.4f      ', real(p(i)) );	else	    str = sprintf( '%+.4f+/-j%.4f  ', real(p(i)), abs(imag(p(i))) );	end	text( 0, y, str, 'Hor', 'Right', 'Ver', 'Mid'); y = y - 0.1;    end    if ~isempty(z)	z = z( ~isnan(z) & ~isinf(z) );	z = cplxpair(z);	y = 0.05*(ceil(length(z)/2)+1);	str = '        Zeros:';	text( 0, y, str, 'Hor', 'Left', 'Ver', 'Mid'); y = y - 0.1;	for i = 1:2:length(z);	    if abs(imag(z(i))) < 1e-6		str = sprintf('%+.4f      ', real(z(i)) );	    else		str = sprintf( '  %+.4f+/-j%.4f', real(z(i)), abs(imag(z(i))) );	    end	    text( 0, y, str, 'Hor', 'Left', 'Ver', 'Mid');	    y = y - 0.1;	end    endendif ~hold_status	% Return hold to previous status    hold offend

⌨️ 快捷键说明

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