close all;
d = conv([1 1],[1/10 1]);
d = conv(d, [1/100 1]);

Gp = tf(100,d);
%margin(Gp); hold on;

% Part (a), reduced DC gain compensation
K_R = 7;
%margin(1/K_R*Gp)

% Part (b), dominant pole compensation
K_D = 1/100;
Gc = tf(K_D,[1 0]);
L = Gc*Gp;
%margin(L);

% Part (c), lag compensation
T = 1/1;
a = 10;
Gc = tf([T 1],[a*T 1]);
L = Gc*Gp;
%margin(L);
%xlim([10^-2 10^4]);

% Part (d), lead compensation
T = 1/10;
a = 10;
K_L = 1/22;

Gc = tf(K_L*[10*T 1],[T 1]);
L = Gc*Gp;
margin(L);