Uploaded by Ninh Nguyễn (Sú Sama)

EGH421 PST 2 n10166661

advertisement
Q1. c) MATLAB script that calculates the closed-loop transfer function, T(s) and simulate the step
response of T(s):
% Define the plant transfer function
G = tf(10, [1, 18, 87, 180]);
% Define the controller transfer function
C = tf([1.0766, 9*1.0766], 1);
% Calculate the closed-loop transfer function
H = 1;
T = feedback(C*G, 1);
% Plot the step response of the closed-loop system
step(T);
% Label the plot
title('Step Response of Closed-Loop System');
xlabel('Time (seconds)');
ylabel('Amplitude');
% Add a legend to the plot
legend('Closed-Loop System');
d) Explain if the OS% = 10% as designed in part 1b.
MATLAB script:
% Define the transfer function
G = tf([10.766, 96.894], [1, 18, 87, 180]);
G_approx = tf(10.766, [1, 6, 15]);
% Calculate the closed-loop transfer function
H = feedback(G, 1);
H_approx = feedback(G_approx, 1);
% Plot the step response
step(H);
hold on
step(H_approx);
hold off
% Calculate and print the overshoot
info = stepinfo(H);
OS = info.Overshoot;
fprintf('Overshoot: %.2f%%\n', OS);
info_1 = stepinfo(H_approx);
OS_approx = info_1.Overshoot;
fprintf('Overshoot of approx TF: %.2f%%\n', OS_approx);
% Add horizontal line at 10% overshoot
hold on;
yline(1.1, '--r');
hold off;
% Add annotations to plot
title('Step Response of Closed-loop TF');
xlabel('Time (s)');
ylabel('Amplitude');
text(0.8, 0.38, sprintf('Overshoot = %.2f%%', OS), 'Units', 'normalized',
'BackgroundColor', 'w', 'EdgeColor', 'k');
text(0.8, 0.46, sprintf('Overshoot of approx TF = %.2f%%', OS_approx), 'Units',
'normalized', 'BackgroundColor', 'w', 'EdgeColor', 'k');
legend('G(s) = 10*Kp*(s+9)/[(s+12)*(s^2+6s+15)]', 'G_approx(s) =
10*Kp/(s^2+6s+15)');
Comment: From the above figure, it can be seen that the %OS is not at 10% as designed but at
7.43%. As it can be seen from the graph, the zero at s = -9 speeds up the response of the system and
reduce the %OS comparing the second-order dominance transfer function.
Q2. a) MATLAB code:
num = 1000;
den = conv([1 0], [1 110 1250]);
G = tf(num, den);
os = 0.2; % 20% Overshoot
Ts = 0.11; % 110 ms settling time
zeta
wn =
p1 =
p2 =
= -log(os)/sqrt(pi^2+log(os)^2);
4/(Ts*zeta);
-zeta*wn + 1i*wn*sqrt(1-zeta^2);
-zeta*wn - 1i*wn*sqrt(1-zeta^2);
%Compute the require gain
K = abs(polyval(den, p1))/abs(polyval(num, p1));
Gc = tf(K,1);
%Draw root locus for G(s) when Gc = K
figure;
rlocus(G, 'g');
hold on
rlocus(G*Gc, 'r--');
xline(-4/Ts,'c');
theta = acos(0.456);
x1 = linspace(0, -200, 100);
y1 = tan(pi-theta)*x1;
plot(x1, y1, 'm-.', 'Linewidth', 3)
plot(real(p1), imag(p1), 'bx', 'Markersize', 10, 'Linewidth', 2);
plot(real(p2), imag(p2), 'bx', 'Markersize', 10, 'Linewidth', 2);
hold off;
grid on;
axis equal;
legend('Root Locus', 'Gain-Only Controller', 'Settling Time limit', 'Overshoot
limit', 'Dominant Poles');
title('Root Locus Plot with Gain-only Controller');
xlabel('Re');
ylabel('Im');
Below is the root locus plot (via MATLAB) and boundaries of the region where the dominant closedloop poles must be to satisfy the transient requirements are formed by the settling time limit and the
Overshoot limit. From the plot, it can be seen that it is impossible to achieve the transient
requirements with just gain-only controller because the root locus when 𝐺𝑐 = 𝐾𝑐 barely intersects
with the required region.
Download