📄 ex3_5.m
字号:
%%%%%%%%%%%%%%%%%% Example 3.5 %%%%%%%%%%%%%%%%%%% 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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ---- 2-input feedback system ----%cleardisp('Example 3.5')% --- define: sampling period, controller gain, integral time constant ---Ts = 0.04, Kp = 10, Ki = 1/20Gp = tf([0.0031 0.003],[1 -1.9 0.905],Ts) % plant as TF objectH = tf(0.55,[1 -0.45],Ts) % sensor as TF object Gc = tf([Kp*Ki*Ts 0],[1 -1],Ts) % integral controllerdisp('******>'), pause %------- CL transfer function for reference input -----------Tref = feedback(Gp*Gc,H) [zTref,pTref,kTref] = zpkdata(Tref,'v') % zeros, poles, gaindisp('Poles in polar form')[mag_pTref,theta_pTref] = xy2p(pTref); % poles in polar formdisp('******>'), pause disp('DC gain and step response in reference input')Tref_gainDC = dcgain(Tref) % reference DC gaindtime = 0:Ts:10; % discrete time vector for 10 secondsyref = step(Tref,dtime); % response to step in reference inputdisp('******>'), pause %------- repeat for disturbance input -------------Tdist = feedback(Gp,Gc*H) [zTdist,pTdist,kTdist] = zpkdata(Tdist,'v') % zeros, poles, gaindisp('Poles in polar form')[mag_pTdist,theta_pTdist] = xy2p(pTdist); % poles in polar formdisp('DC gain and step response in disturbance input')Tdist_gainDC = dcgain(Tdist) % disturbance DC gainydist = step(Tdist,dtime); % response to step in disturbance input disp('******>'), pause %------ plot step responses at every 10th point ----------kk = [1:10:10/Ts]; figureplot(dtime(kk),yref(kk),'*');grid % plot reference step responsehold onplot(dtime(kk),ydist(kk),'o'); % plot disturbance step responsehold offtitle('Step responses for Example 3.5')xlabel('Time (s)')text(6.5,0.90,'reference') % add labels to plotstext(3.2,0.45,'disturbance')%%%%%%%%%%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -