📄 ex3_6.m
字号:
%%%%%%%%%%%%%%%%%% Example 3.6 %%%%%%%%%%%%%%%%%%
% 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 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ---- Feedback connection using a selective output ----
%
clear
disp('Example 3.6')
Ts = 0.05 % sampling time
% enter 1-input/2-output system
G1 = tf(0.01340,conv([1 -0.9394],[1 -0.7788]),Ts)
disp('******>'), pause
G2 = tf(0.2212,[1 -0.7788],Ts)
disp('******>'), pause
G = [G1; G2] % adjoin system
disp('******>'), pause
Gc = 3
% ---- part a: controller in feedback path ------
% Gc connects from output 2 to input 1
Gcla = feedback(G,Gc,1,2)
disp('******>'), pause
Gcla = minreal(Gcla) % eliminate redundent poles and zeros
disp('******>'), pause
dtime = 0:Ts:4; % time vector
ya = step(Gcla,dtime); % step response
figure
plot(dtime,ya(:,1),'o',dtime,ya(:,2),'*');grid % plot y1 & y2
xlabel('Time (s)')
ylabel('Amplitude')
title('Step response with controller in feedback path for Example 3.6')
text(0.3,0.22,'y_2')
text(1.25,0.17,'y_1')
axis([0 4 0 0.3])
% ---- part b: controller in forward path ------
% Gc connects from output 2 to input 1
Gclb = feedback(G*Gc,1,1,2)
disp('******>'), pause
Gclb = minreal(Gclb) % eliminate redundent states
disp('******>'), pause
yb = step(Gclb,dtime); % step response
figure
plot(dtime,yb(:,1),'o',dtime,yb(:,2),'*');grid % plot y1 & y2
xlabel('Time (s)')
ylabel('Amplitude')
title('Step response with controller in forward path for Example 3.6')
text(0.3,0.7,'y_2')
text(1.25,0.5,'y_1')
%%%%%%%%%%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -