📄 ch8p2.m
字号:
'(ch8p2) Example 8.8' % Display label.
clear % Clear variables from workspace.
clf % clear graph on screen.
j=.21
numg=j*[1 .055]; % Define numerator of G(s).
deng=[3.984e-007 0.0001931 1.292 0]; % Define denominator of G(s).
'G(s)' % Display label.
G=tf(numg,deng) % Create and display G(s).
rlocus(G) % Draw root locus (H(s)=1).
title('Original Root Locus') % Add title.
pause
K=0:.5:50; % Specify range of gain to smooth
% root locus.
rlocus(G,K) % Draw smoothed root locus (H(s)=1).
title('Smoothed Root Locus') % Add title.
pos=input('Type %OS '); % Input desired percent overshoot
% from the keyboard.
z=-log(pos/100)/sqrt(pi^2+[log(pos/100)]^2)
% Calculate damping ratio.
sgrid(z,0) % Overlay desired damping ratio line
axis([-3 3 -15 15])
% on root locus.
title(['Root Locus with ',num2str(pos),'% overshoot line'])
% Define title for root locus
% showing percent overshoot used.
[K,p]=rlocfind(G) % Generate gain, K, and closed-loop
% poles, p, for point selected
% interactively on the root locus.
pause
'T(s)' % Display label.
T=feedback(K*G,1) % Find closed-loop transfer function
% with selected K and display.
step(T) % Generate closed-loop step response
% for point selected on root locus.
title(['Step Response for K=',num2str(K)])
% Give step response a title which
% includes the value of K.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -