clear all; close all;
A = 1;
omega1 = 0.1;
omega2 = 0.5;
omega3 = 1.0;
omega4 = 10.0;
num = [ 0 0 1 ];
den = [ 2 10.2 1 ];
sys = tf( num, den );
t = 0:0.01:50;
u1 = A*sin( omega1*t );
x0 = [ 0 ];
[ y1, t1, x1 ] = lsim( sys, u1, t, x0 );
subplot(2,2,1)
plot(t,u1,'-b',t1,y1,'-r');
xlim([0,50])
ylim([-1.0 1.0])
xticks([0 10 20 30 40 50])
yticks([-1.0 -0.5 0.0 0.5 1.0])
grid;
xlabel('time t [s]');
ylabel('input and output')
u2 = A*sin( omega2*t );
x0 = [ 0 ];
[ y2, t2, x2 ] = lsim( sys, u2, t, x0 );
subplot(2,2,2)
plot(t,u2,'-b',t2,y2,'-r');
xlim([0,50])
ylim([-1.0 1.0])
xticks([0 10 20 30 40 50])
yticks([-1.0 -0.5 0.0 0.5 1.0])
grid;
xlabel('time t [s]');
ylabel('input and output')
u3 = A*sin( omega3*t );
x0 = [ 0 ];
[ y3, t3, x3 ] = lsim( sys, u3, t, x0 );
subplot(2,2,3)
plot(t,u3,'-b',t3,y3,'-r');
xlim([0,50])
ylim([-1.0 1.0])
xticks([0 10 20 30 40 50])
yticks([-1.0 -0.5 0.0 0.5 1.0])
grid;
xlabel('time t [s]');
ylabel('input and output')
u4 = A*sin( omega4*t );
x0 = [ 0 ];
[ y4, t4, x4 ] = lsim( sys, u4, t, x0 );
subplot(2,2,4)
plot(t4,y4,'-r');
xlim([40,50])
ylim([-0.010 0.010])
xticks([40 42 44 46 48 50])
yticks([-0.010 -0.005 0 0.005 0.010])
grid;
xlabel('time t [s]');
ylabel('output')