reinf2_13.m
来自「离散控制系统设计的MATLAB 代码」· M 代码 · 共 37 行
M
37 行
%%%%%%%%%%% Reinforcement Problem 2.13 %%%%%%%%%%% 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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --- Response to a ramp-to-constant input ---%cleardisp('Reinforcement Problem 2.13')numG = [0.2 1.1 0.5] % numerator of G(z)denG = [1 0.7 0.5 0.1] % denominator of G(z)Ts = 0.2 % sampling period = 0.2 sG = tf(numG,denG,Ts) % create TF object G(z)dtime = [0:Ts:5]'; % discrete time samplesu1 = zeros(size(dtime)); % start with all input values = 2.0i1 = min(find(dtime>=2));for i=1:i1, % use find cmd to get indices of u1(i)=2*dtime(i); % ...elements to be changedendfor i=i1+1:length(u1), u1(i) = u1(i1);endy = lsim(G,u1,dtime); % compute response due to input ufigurestem(dtime,y,'filled');grid % plot response of G(z) due to uhold onplot(dtime,u1,'o') % plot inputhold offaxis([0 5 0 4.5]);text(1.4,3.7,'input')text(3.4,3.3,'output') % add labels to plottitle('Reinforcement Problem 2.13')disp('Final value = ')disp(4*dcgain(G))%%%%%%%%%%
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?