ex2_10.m

来自「离散控制系统设计的MATLAB 代码」· M 代码 · 共 44 行

M
44
字号
%%%%%%%%%%%%%%%%% Example 2.10 %%%%%%%%%%%%%%%%%%%   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                 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   ---- Blocking zeros ----%cleardisp('Example 2.10')zz = [-0.3; exp(0.5i); exp(-0.5i)];   % zeros of G(z)pp = [0.9; 0.7; 0.7; -0.5];           % poles of G(z)gn = 1, Ts = 1                        % unity gain & sampling periodG = zpk(zz,pp,gn,Ts)                  % build G(z) as ZPK objectfigureucircle, axis equal, hold on          % set up unit circlepzmap(G), hold off                    % plot poles & zerosset_xo_size                           % show larger X's and O'sdisp('Plotting pole-zero locations')disp('******>'), pause %--- zeros determined as roots of numerator polynomial ----[numG,denG] = tfdata(G,'v')           % zeros determined as roots     %--- magnitudes and angles of zeros from tfdata command ---disp('Zeros of G via roots command')xy2p(roots(numG));                    % ...of numerator polynomial%--- magnitudes and angles of zeros from tzero command ---disp('Zeros of G via tzero command')xy2p(tzero(G));                       % zeros determined by 'tzero' commandk  = [0:50];                          % generate discrete time arrayu  = sin(0.5*k);                      % generate discrete input sequence signal[ylsim,k] = lsim(G,u);                % compute system response due to u(k)figurestem(k,ylsim,'filled'),grid           % plot responsehold on plot(k,u,'o'), hold off               % plot sinusoidal inputtext(31,0.8,'input')text(16,1.9,'output')title('Example 2.10')xlabel('Discrete time (k)')%%%%%%%%%%

⌨️ 快捷键说明

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