clear all; close all;
T1 = 0.1;
T2 = 1.0;
T3 = 10.0;
num = [ 0 1 ];
den1 = [ T1 1 ];
den2 = [ T2 1 ];
den3 = [ T3 1 ];
sys1 = tf( num, den1 );
sys2 = tf( num, den2 );
sys3 = tf( num, den3 );
w = logspace(-2, 2, 1000);
[ gain1 phase1 w1 ] = bode( sys1, w );
gain1 = gain1(:);
gain1dB = 20*log10(gain1);
[ gain2 phase2 w2 ] = bode( sys2, w );
gain2 = gain2(:);
gain2dB = 20*log10(gain2);
[ gain3 phase3 w3 ] = bode( sys3, w );
gain3 = gain3(:);
gain3dB = 20*log10(gain3);
subplot(2,1,1)
semilogx(w1, gain1dB, w2, gain2dB, w3, gain3dB);
xlim([10^(-2),10^2])
ylim([-70 0])
yticks([-60 -40 -20 0])
grid;
xlabel('Frequency (rad/s)');
ylabel('Gain [dB]');
legend('T=0.1', 'T=1', 'T=10');
t = 0:0.01:60;
[ y1 t1 ] = step( sys1, t );
[ y2 t2 ] = step( sys2, t );
[ y3 t3 ] = step( sys3, t );
subplot(2,1,2)
plot(t1,y1,'-b',t2,y2,'-g',t3,y3,'-r');
xlim([0,60])
ylim([0 1.0])
xticks([0 10 20 30 40 50 60])
yticks([0 0.2 0.4 0.6 0.8 1.0])
grid;
xlabel('time t [s]');
ylabel('output');
legend('T=0.1', 'T=1', 'T=10');