pkg load control
#====================================
G=5
tau=0.5
 
F = tf([G],[tau,1])
STEP= tf([1],[1,0])
t_end=15

t=0:0.01:t_end

figure(1)
%------------------------------------
subplot(1,2,1)

for i = 1:1:5
  F = tf([G],[tau,1])
  hold on
  p=step(F,t)   
  h=plot(t,p,'LineWidth',2,axis([0 t_end -1 6]))
  hold on
  LEG{i} = ['tau = ' num2str(tau)];
  hold on
  tau = tau + 0.5
end
     
legend(LEG,4);   
xlabel('time (s)')  
     
title('STEP RESPONSE')
grid
hold on
%------------------------------------
subplot(1,2,2)
tau=0.5

for i = 1:1:5
  F = tf([G],[tau,1])
  hold on
  pzmap(F*STEP, 'x')
  hold on
  LEG{i} = ['tau = ' num2str(tau)];
  hold on
  tau = tau + 0.5
end
legend(LEG,4);  

#print -deps premier_ordre.eps

#####################################
figure(2)

G=5
ksi=0.1 % Facteur d'amortissement
wn = 10 % pulsation naturelle non amortie

 
F = tf([G],[(1/wn)^2,((2*ksi)/wn),1])
STEP= tf([1],[1,0])
t_end=8

t=0:0.01:t_end

%------------------------------------
subplot(1,2,1)

for i = 1:1:5
  F = tf([G],[(1/wn)^2,((2*ksi)/wn),1])
  hold on
  p=step(F,t)   
  h=plot(t,p,'LineWidth',2,axis([0 t_end -1 9]))
  hold on
  LEG{i} = ['ksi = ' num2str(ksi)];
  hold on
  ksi = ksi+0.3
end
grid
legend(LEG,4);
title('STEP RESPONSE')
xlabel('time (s)')  

subplot(1,2,2)
ksi=0.1

for i = 1:1:5
  F = tf([G],[(1/wn)^2,((2*ksi)/wn),1])
  hold on
  pzmap(F*STEP, 'x')
  hold on
  LEG{i} = ['ksi = ' num2str(ksi)];
  hold on
  ksi = ksi+0.3
end
legend(LEG,4);

#####################################
figure(3)

G=5
ksi=sqrt(2)/2 % Facteur d'amortissement
wn = 10 % pulsation naturelle non amortie
 
F = tf([G],[(1/wn)^2,((2*ksi)/wn),1])
STEP= tf([1],[1,0])
t_end=8

t=0:0.01:t_end

%------------------------------------
subplot(1,2,1)
for i = 1:1:5
  F = tf([G],[(1/wn)^2,((2*ksi)/wn),1])
  hold on
  p=step(F,t)   
  h=plot(t,p,'LineWidth',2,axis([0 1.5 -1 6]))
  hold on
  LEG{i} = ['wn = ' num2str(wn)];
  hold on
  wn = wn+10
end
grid
legend(LEG,4);
title('STEP RESPONSE')
xlabel('time (s)')  
 
subplot(1,2,2)
ksi=sqrt(2)/2
wn = 10 % pulsation naturelle non amortie

for i = 1:1:5
  F = tf([G],[(1/wn)^2,((2*ksi)/wn),1])
  hold on
  pzmap(F*STEP, 'x')
  hold on
  LEG{i} = ['wn = ' num2str(wn)];
  hold on
  wn = wn+10
end
legend(LEG,4);
 
 print -dsvg second_ordre_wn.svg

#####################################

figure(4)

t_end=8

t=0:0.01:t_end

G=1
ksi=0.2% Facteur d'amortissement
wn = 10 % pulsation naturelle non amortie

F = tf([G],[(1/wn)^2,((2*ksi)/wn),1])
p=step(F,t)   
h=plot(t,p,'LineWidth',2)
axis([0 t_end 0 1.6])
grid
