584 Chapter 8 / PID Controllers and Modified PID ControllersTo sort out the solution sets in the order of the magnitude of the maximum overshoot (starting
from the smallest value of mand ending at the largest value of min the table), we use the commandsortsolution = sortrows(solution,3)
MATLAB Program 8–6
%'K' and 'a' values to test
K = [2.0 2.2 2.4 2.6 2.8 3.0];
a = [0.5 0.7 0.9 1.1 1.3 1.5];
% Evaluate closed-loop unit-step response at each 'K' and 'a' combination
% that will yield the maximum overshoot less than 10%
t = 0:0.01:5;
g = tf([1.2],[0.36 1.86 2.5 1]);
k = 0;
for i = 1:6;
for j = 1:6;
gc = tf(K(i)[1 2a(j) a(j)^2], [1 0]); % controller
G = gcg/(1 + gcg); % closed-loop transfer function
y = step(G,t);
m = max(y);
if m < 1.10
k = k+1;
solution(k,:) = [K(i) a(j) m];
end
end
end
solution % Print solution table
solution =
2.0000 0.5000 0.9002
2.0000 0.7000 0.9807
2.0000 0.9000 1.0614
2.2000 0.5000 0.9114
2.2000 0.7000 0.9837
2.2000 0.9000 1.0772
2.4000 0.5000 0.9207
2.4000 0.7000 0.9859
2.4000 0.9000 1.0923
2.6000 0.5000 0.9283
2.6000 0.7000 0.9877
2.8000 0.5000 0.9348
2.8000 0.7000 1.0024
3.0000 0.5000 0.9402
3.0000 0.7000 1.0177
sortsolution = sortrows(solution,3) % Print solution table sorted by
% column 3
(continues on next page)Openmirrors.com