📄 ex7_3.m
字号:
%%%%%%%%%%%%%%%%%% Example 7.3 %%%%%%%%%%%%%%%%%%
% 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 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ---- Step-response performance ----
%
clear
disp('Example 7.3')
Ts = 0.1; % sampling time
Gp = tf(1,[1 1 0]) % plant in continuous tf form
Gz = c2d(Gp,Ts,'zoh') % discretize using zero-order hold
Gc = tf(5*[1 -0.9],[1 -0.7],Ts) % discretize controller in tf form
disp('******>'), pause
%----------- Ideal sensor ----------------
Ta = feedback(Gz*Gc,1,-1) % CL transfer function
k = [0:1:60]'; % discrete-time index
ya = step(Ta,k*Ts); % step response
[Moa,tpa,tra,tsa,essa] = kstats(k*Ts,ya,1)
disp('******>'), pause
%----------- Slow sensor ----------------
H = tf(10,[1 10]) % sensor in continuous tf form
HGz = c2d(H*Gp,Ts,'zoh') % discretize combined H & Gp
Tb = Gz*Gc/(1+HGz*Gc) % CL transfer fucntion
Tb = minreal(Tb) % eliminate duplicate states
disp('******>'), pause
yb = step(Tb,k*Ts); % step response
[Mob,tpb,trb,tsb,essb] = kstats(k*Ts,yb,1)
disp('******>'), pause
figure
plot(k*Ts,ya,'*');grid
hold on
plot(k*Ts,yb,'o')
hold off
axis([0 6 0 1.2])
xlabel('Time (s)')
ylabel('Amplitude')
text(3.5,0.35,'* ==> ideal sensor')
text(3.5,0.25,'o ==> slow sensor')
title('Step responses for Example 7.3')
%%%%%%%%%%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -