% % Written by: % -- % John L. Weatherwax 2006-02-01 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- % Pt a: % h=0:0.1:3.0; u1 = -0.5 + 2*(1-sqrt(h)); u2 = +0.5 - 2*(1-sqrt(h)); figure; hnd1=plot( h, u1, '-xb' ); hold on; hnd2=plot( h, u2, '-og' ); grid on; text( 1, 0.5+10^(-1), 'q_r' ); text( 1, -0.5-10^(-1), 'q_l' ); xlabel( 'h' ); ylabel( 'u' ); legend( [ hnd1, hnd2 ], { '1-integral curve', '2-integral curve' }, 'Location', 'Best' ); title( 'Part (a)' ); saveas( gcf, './Graphics/chap_13_prob_2_pt_a.eps', 'psc2' ); % Pt b: % hl = 1.0; ul = -1.9; hr = 1.0; ur = +1.9; h=0:0.1:3.0; u1 = ul + 2*(sqrt(hl)-sqrt(h)); u2 = ur - 2*(sqrt(hr)-sqrt(h)); figure; hnd1=plot( h, u1, '-xb' ); hold on; hnd2=plot( h, u2, '-og' ); grid on; text( hr, ur+10^(-1), 'q_r' ); text( hl, ul-10^(-1), 'q_l' ); xlabel( 'h' ); ylabel( 'u' ); axis( [ 0 1.5 -2 2 ] ); legend( [ hnd1, hnd2 ], { '1-integral curve', '2-integral curve' }, 'Location', 'Best' ); title( 'Part (b)' ); saveas( gcf, './Graphics/chap_13_prob_2_pt_b.eps', 'psc2' ); % Pt c: % hl = 1.0; ul = -2.1; hr = 1.0; ur = +2.1; h=0:0.1:3.0; u1 = ul + 2*(sqrt(hl)-sqrt(h)); u2 = ur - 2*(sqrt(hr)-sqrt(h)); figure; hnd1=plot( h, u1, '-xb' ); hold on; hnd2=plot( h, u2, '-og' ); grid on; text( hr, ur+10^(-1), 'q_r' ); text( hl, ul-10^(-1), 'q_l' ); xlabel( 'h' ); ylabel( 'u' ); legend( [ hnd1, hnd2 ], { '1-integral curve', '2-integral curve' }, 'Location', 'Best' ); title( 'Part (c)' ); saveas( gcf, './Graphics/chap_13_prob_2_pt_c.eps', 'psc2' );