%uppg2421

%a
G1a=tf([8],[1 2])
G2a=tf([2],[1 3 2])
G3a=tf([1],[0.2 1])

%Gka=G1*G2*G3

%margin(Gk)
grid on



%b
G1b=tf([1],[1 2 0])
G2b=tf([2],[1 4 2])
G3b=tf([1],[1])
%Gkb = G1*G2*G3
%margin(Gk)


%c
subplot(2,1,1)
title('step a')
Ha = feedback(G1a*G2a, G3a)
step(Ha)

subplot(2,1,2)
title('step b')
Hb = feedback(G1b*G2b, G3b)
step(Hb)
G1a =
 
    8
  -----
  s + 2
 
Continuous-time transfer function.


G2a =
 
        2
  -------------
  s^2 + 3 s + 2
 
Continuous-time transfer function.


G3a =
 
      1
  ---------
  0.2 s + 1
 
Continuous-time transfer function.


G1b =
 
      1
  ---------
  s^2 + 2 s
 
Continuous-time transfer function.


G2b =
 
        2
  -------------
  s^2 + 4 s + 2
 
Continuous-time transfer function.


G3b =
 
  1
 
Static gain.


Ha =
 
                3.2 s + 16
  --------------------------------------
  0.2 s^4 + 2 s^3 + 6.6 s^2 + 8.8 s + 20
 
Continuous-time transfer function.


Hb =
 
                2
  ------------------------------
  s^4 + 6 s^3 + 10 s^2 + 4 s + 2
 
Continuous-time transfer function.