clear all; close all;
num = [ 0 1 ];
den = [ 1 1 ];
Kp = 1.0;
Ki1 = 0.5;
Ki2 = 0.75;
Ki3 = 5.0;
numc1 = [ Kp, Ki1 ];
numc2 = [ Kp, Ki2 ];
numc3 = [ Kp, Ki3 ];
denc = [ 1, 0 ];
sys = tf( num, den );
c1 = tf( numc1, denc );
c2 = tf( numc2, denc );
c3 = tf( numc3, denc );
sysc1 = feedback( c1*sys, 1);
sysc2 = feedback( c2*sys, 1);
sysc3 = feedback( c3*sys, 1);
t = 0:0.01:20;
[ y0, t0 ] = step( sys, t );
[ y1, t1 ] = step( sysc1, t );
[ y2, t2 ] = step( sysc2, t );
[ y3, t3 ] = step( sysc3, t );
plot(t0,y0,'-b',t1,y1,'-g',t2,y2,'-y',t3,y3,'-r');
xlim([0,20])
ylim([0.0 1.4])
xticks([0 5 10 15 20])
yticks([0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4])
grid;
xlabel('time t [s]');
ylabel('y(t)')
legend('K_p=0,K_i=0','K_p=1,K_i=0.5','K_p=1,K_i=0.75','K_p=1,K_i=5');