a = -1;
b = 1;
q = 1;
r = 1;

A = a;
B = [1, b];
C = [sqrt(q); 0; 1];
D = [0, 0; 0, sqrt(r); 0, 0];
G = ss(A, B, C, D);

[K, clp, gopt] = hinfsyn(G, 1, 1, 'TOLGAM', 0.00001, 'DISPLAY', 'on');

figure(1);
bode(K); % K is approximimately -1
dcgain(K) 

clp0 = lft(G, 0); % closed-loop system with 0 controller

figure(2);
sigma(clp0, 'b', clp, 'r', ss(gopt), 'g--');
legend('without control', 'with control', 'hinf norm');
norm(clp, 'inf') % closed-loop H infinity norm is approximately 1/sqrt(2)
