s = tf('s'); sample = 0.001; % sampling time for discretized controller load nominal.mat; load weight.mat; W = ss([1; 1]); systemnames = 'P0 WT W'; inputvar = '[ w; u ]'; outputvar = '[ WT; W ]'; input_to_P0 = '[ w + u ]'; input_to_WT = '[ u ]'; input_to_W = '[ P0 ]'; cleanupsysic = 'yes'; G = sysic; G = balreal(G); d = 1; gam = 200; [K, clp, gopt] = hinfsyn(mdiag(1,1/gam,1)*G, 1, 1, 'GMIN', 1., 'GMAX', 1.); Kd = c2d(K, sample); tmp = [Kd.a, Kd.b; Kd.c, Kd.d]; save cont.dat sample tmp -ascii -double; n = size(K.a, 1); fid = fopen('cont_order.dat', 'w'); fprintf(fid, '%d\n', n); fclose(fid); save cont.mat K Kd G; save cont_ex3.mat K Kd G;