clear all;
close all;

s = tf('s');

P = 1/(s^3+1.5*s^2+1.5*s+1); % example of open-loop system

K = ss(1); % controller

figure(1);
bode(K, 'b');
hold on;

figure(2);
nyquist(P*K, 'b'); % check for closed-loop stability
hold on;

S = 1/(1+P*K); % sensitivity function

figure(3);
bodemag(S, 'b'); % gain characteristic of sensitivity function
hold on;

figure(4);
T = 1 - S; % complementary sensitivity function 
step(T, 'b', 10); % step response
hold on;
