function [] = prob_13_12() % % Written by: % -- % John L. Weatherwax 2006-09-07 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- close all; % The state is defined by q=(v,\phi): % q_l = [ 0 1 ]; q_r = [ 1 0.5 ]; % Compute the shock/CD speeds: % s1 = q_l(2)^2; s2 = q_r(2)^2 + q_r(2)*q_l(2) + q_l(2)^2; % Compute the middle state: % q_m(1) = q_r(1)*q_l(2)/q_r(2); q_m(2) = q_l(2); % Draw the x-t diagram solution to this Riemann problem (at time="time"): % time=1.0; figure; hold on; line( [ 0; s1*time ], [ 0 ; time ] ); line( [ 0; s2*time ], [ 0 ; time ] ); text( .379, .885, ['(v_l,\phi_l)=(',num2str(q_l(1)),', ',num2str(q_l(2)),')'] ); text( 1.04, 0.87, ['(v_m,\phi_m)=(',num2str(q_m(1)),', ',num2str(q_m(2)),')'] ); text( 1.35, 0.689, ['(v_r,\phi_r)=(',num2str(q_r(1)),', ',num2str(q_r(2)),')'] ); text( .131, .385, ['s^1 = \phi_l^2=',num2str(s1)] ); text( .458, 0.151, ['s^2 = \phi_r^2 + \phi_r \phi_l + \phi_l^2=',num2str(s2)] ); %axis( [ -1 2 0 1 ] ); xlabel( 'x' ); ylabel( 't' ); %grid on; saveas( gcf, 'prob_13_12_xt.eps', 'psc2' );