clear all;
close all;

load data/nominal.mat;

% ロバスト安定化のための重み
%s = tf('s');
%w1 = 158;
%zeta1 = 0.68;
%w0 = 0.25;
%W1 = w0*(s^2 + 2*zeta1*w1*s + w1^2)/w1^2;
%w2 = 200;
%zeta2 = 0.9;
%W2 = w2^2/(s^2 + 2*zeta2*w2*s + w2^2);
%w3 = 2200;
%zeta3 = 0.2;
%W3 = w3^2/(s^2 + 2*zeta3*w3*s + w3^2);

%W = W1*W2;

%W = ss(0.1);
W = ss(0.15); % data38 で stable
%W = ss(0.17); % data36 で stable
%W = ss(0.24);

W_g = frd(W, w);

delta_g = G_g(2,2) - G0_g(2,2);

figure(5);
clf;
bodemag(delta_g, 'b.', W_g, 'r-');
legend('additive uncertainty', 'W', 'Location', 'SouthWest');
title('');
save data/weight.mat W;
print -djpeg90 -r70 data/uncertain.jpg;
