dzline.m

来自「ipr函数库与仿真实验程序,都是要用到的库函数。」· M 代码 · 共 36 行

M
36
字号
function  dzline(zeta)
%   DZLINE(ZETA) draws the lines of constant damping ratio
%		for a discrete-time system, where ZETA can be a scalar
%		or a vector of damping ratios.
%		The lines should be plotted in the z-plane.
%	    The hold state (on/off) will be left the way it was
%		before the function was called.

%%%%%%%%%%%%%%%%%%% dzline.m %%%%%%%%%%%%%%%%%%%%
%   Discrete-Time Control Problems using        %
%       MATLAB and the Control System Toolbox   %
%   by J.H. Chow, D.K. Frederick, & N.W. Chbat  %
%         Brooks/Cole Publishing Company        %
%                September 2002                 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

theta = acos(zeta);
phi = pi-theta;
r = [0:0.1:5];
[mm,nn] = size(phi);

for jj = 1:nn,
	s1=r*exp(i*phi(jj));  % ray from origin in upper half of s-plane 
	s2=r*exp(-i*phi(jj)); % ray from origin in lower half of s-plane 
	z1=exp(s1);           % log spiral in upper half of z-plane
	z2=exp(s2);           % log spiral lower half of z-plane
	ii = find(imag(z1)>=0);% plot only points in upper half plane
	jj = find(imag(z2)<=0);% plot only points in lower half plane
	plot(z1(ii),':')
	if ishold ~= 1, hold on, hold_was_off = 1; else hold_was_off = 0; end
	plot(z2(jj),':')
	if hold_was_off == 1, hold off, else hold on, end
end
%%%%%%%%%%

⌨️ 快捷键说明

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