% controller design with LQ game type generalized plant clear all; close all; s = tf('s'); Ap = [0, 1, 0; 0, -10, 64.1; 0, -43.6, 0]; Bp = [0; 0; 5.97]; Cp = [1, 0, 0]; P0 = ss(Ap, Bp, Cp, 0); figure(1); bode(P0); WS = 100/(s^2 + s + 1); WT = ((s^2 + 2*1*31.4*s + 31.4^2)*314^2*0.8)/((s^2 + 2*1*314*s + 314^2)*31.4^2) * (s/31.4 + 1)/(s/314 + 1); Wst = blkdiag(80, 3, 1); Wu = WT; % controller design with proper weight WT systemnames = 'P0 WT WS'; inputvar = '[ w; u ]'; outputvar = '[ WS; WT; w+P0 ]'; input_to_P0 = '[ u ]'; input_to_WT = '[ P0 ]'; input_to_WS = '[ w+P0 ]'; cleanupsysic = 'yes'; G = sysic; [K, clp, gopt] = hinfsyn(G, 1, 1, 'DISPLAY', 'on'); % controller design with LQ game type generalized plant WstP0 = ss(Ap, Bp, [Wst; Cp], zeros(4, 1)); systemnames = 'WstP0 Wu'; inputvar = '[ w; u ]'; outputvar = '[ WstP0(1:3); Wu; WstP0(4) ]'; input_to_WstP0 = '[ u+w ]'; input_to_Wu = '[ u ]'; cleanupsysic = 'yes'; Glqgame = sysic; [Klqgame, clplqgame, goptlqgame] = hinfsyn(Glqgame, 1, 1, 'DISPLAY', 'on'); figure(2); bode(K, 'b--', Klqgame, 'r'); legend('with WT', 'with WTlqgame'); grid on; axis([0.01, 100, 80, 330]); % phase h = get(2); axis(h.Children(4),[0.01, 100, 10, 70]); % gain S = 1/(1 - P0*K); T = 1 - S; Slqgame = 1/(1 - P0*Klqgame); Tlqgame = 1 - Slqgame; figure(3); bodemag(S, 'r', gopt/WS, 'r--', T, 'b', gopt/WT, 'b--', ... Slqgame, 'g', Tlqgame, 'm', goptlqgame/WT, 'm--'); legend('S', 'gamma/WS', 'T', 'gamma/WT', ... 'Slqgame', 'Tlqgame', 'gammalqgame/WTlqgame'); axis([0.01, 100, -60, 30]); grid on; % step response figure(4); t = 0:0.01:1'; step(T, 'b--', Tlqgame, 'r', t)