📄 ex7_5.m
字号:
%%%%%%%%%%%%%%%%%% Example 7.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 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ---- Position and velocity error constants ----
%
clear
disp('Example 7.5')
Gp = tf(1,[1 1 0]) % plant in continuous tf form
Ts = 0.1; % sampling time
Gz = c2d(Gp,Ts,'zoh') % discretization using zero-order hold
Kz = tf(5*[1 -0.9],[1 -0.7],Ts) % controller in discrete tf form
Kp = dcgain(Gz*Kz) % position error constant
Kv = vgain(Gz*Kz) % velocity error constant
Ta = feedback(Gz*Kz,1,-1) % CL transfer function
k = [0:1:40]';
y = lsim(Ta,k*Ts,k*Ts); % simulate system with ramp input
figure
plot(k*Ts,k*Ts,'o'),grid,hold on % plot ramp input
plot(k*Ts,y,'*'),hold off % plot ramp response
xlabel('Time (s)')
ylabel('Amplitude')
text(1.0,2.1,'Ramp input')
text(2.6,1.8,'Response')
title('Ramp input and response for Example 7.5')
%%%%%%%%%%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -