% % 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); t_final = 1.0; % 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] ); figure; subplot( 1,3, 1 ); ha= plot( t_a, y_a(:,1), 'r' ); hold on; hb= plot( t_b, y_b(:,1), 'g' ); hc= plot( t_c, y_c(:,1), 'b' ); axis tight; title('p11'); subplot( 1,3, 2 ); ha= plot( t_a, y_a(:,2), 'r' ); hold on; hb= plot( t_b, y_b(:,2), 'g' ); hc= plot( t_c, y_c(:,2), 'b' ); axis tight; title('p12'); legend( [ha,hb,hc], {'Part (a)','Part (b)','Part (c)'}, 'location', 'east' ); subplot( 1,3, 3 ); plot( t_a, y_a(:,3), 'r' ); hold on; plot( t_b, y_b(:,3), 'g' ); plot( t_c, y_c(:,3), 'b' ); axis tight; title('p22'); fn = [ '../../WriteUp/Graphics/Chapter4/sect_5_prob_1_plots.eps' ]; %saveas( gcf, fn, 'epsc' );