% % Written by: % -- % John L. Weatherwax 2005-08-14 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- clear functions; clear; close all; clc; randn('seed',0); rand('seed',0); % Integrate each system with measurements to the point t_final % t_final = 0.2; % Part (a): % [t_a,y_a] = ode45( @sect_5_1_ode_fn_part_a, [0, t_final], [0;0;0] ); % Part (b): % [t_b,y_b] = ode45( @sect_5_1_ode_fn_part_b, [0, t_final], [0;0;0] ); % Part (c): % [t_c,y_c] = ode45( @sect_5_1_ode_fn_part_c, [0, t_final], [0;0;0] ); % Integrate the modified systems dropping the measurement variance reduction term in each case % [t_a_p,y_a_p] = ode45( @sect_5_1_ode_fn, [t_final,2*t_final], y_a(end,:)); [t_b_p,y_b_p] = ode45( @sect_5_1_ode_fn, [t_final,2*t_final], y_b(end,:)); [t_c_p,y_c_p] = ode45( @sect_5_1_ode_fn, [t_final,2*t_final], y_c(end,:)); figure; subplot( 1,3, 1 ); plot( t_a, y_a(:,1), 'r' ); hold on; plot( t_a_p, y_a_p(:,1), '-.r' ); plot( t_b, y_b(:,1), 'g' ); plot( t_b_p, y_b_p(:,1), '-.g' ); plot( t_c, y_c(:,1), 'b' ); plot( t_c_p, y_c_p(:,1), '-.b' ); axis tight; title('p11'); subplot( 1,3, 2 ); ha= plot( t_a, y_a(:,2), 'r' ); hold on; hap= plot( t_a_p, y_a_p(:,2), '-.r' ); hb= plot( t_b, y_b(:,2), 'g' ); hbp= plot( t_b_p, y_b_p(:,2), '-.g' ); hc= plot( t_c, y_c(:,2), 'b' ); hcp= plot( t_c_p, y_c_p(:,2), '-.b' ); axis tight; title('p12'); subplot( 1,3, 3 ); ha= plot( t_a, y_a(:,3), 'r' ); hold on; hap= plot( t_a_p, y_a_p(:,3), '-.r' ); hb= plot( t_b, y_b(:,3), 'g' ); hpb= plot( t_b_p, y_b_p(:,3), '-.g' ); hc= plot( t_c, y_c(:,3), 'b' ); hcp= plot( t_c_p, y_c_p(:,3), '-.b' ); legend( [ha,hap,hb,hbp,hc,hcp], {'Part (a)','(a)-pred','Part (b)','(b)-pred','Part (c)','(c)-pred'}, 'location', 'southeast' ); axis tight; title('p22'); fn = [ '../../WriteUp/Graphics/Chapter4/sect_5_prob_2_plots.eps' ]; %saveas( gcf, fn, 'epsc' );