%
% Example 12.3
%
global k;
close all;
fs = 24;
%
k = [ 0; 0 ];
[ t, x ] = ode45( 'Spring_and_Damper', [ 0 10 ], [ 0 5 0 0 ] );
%
figure;
plot( t, x(:,1) );
set( gca, 'fontsize', fs );
xlabel( 'Time in seconds' );
ylabel( 'True Position' );
%
figure;
plot( t, x(:,2), '-', t, x(:,4), ':' );
set( gca, 'fontsize', fs );
xlabel( 'Time in seconds' );
ylabel( 'Velocity' );
hold on;
k = [ 3; 3 ];
[ t, x ] = ode45( 'Spring_and_Damper', [ 0 10 ], [ 0 5 0 0 ] );
plot( t, x(:,4), '--' );
hold off;
%
k = [ 6; 15 ];
[ t, x ] = ode45( 'Spring_and_Damper', [ 0 10 ], [ 0 5 0 0 ] );
figure;
plot( t, x(:,2), '-', t, x(:,4), '--' );
set( gca, 'fontsize', fs );
xlabel( 'Time in seconds' );
ylabel( 'Velocity' );
%
print -f1 -deps2 fig12truepos.eps
print -f2 -deps2 fig12kalm1a.eps
print -f3 -deps2 fig12kalm1b.eps
%

