% % code03.m -- 18 oct 02 -- djm % % #3.9.15 plotting code % % clear workspace & graphics ("help clear", etc) clear; close all % set vector of t-points for 3 intervals t1 = 0 :pi/50: pi; t2 = pi:pi/50:2*pi; t3 = 2*pi:pi/50:6*pi; % calculate u-values in each interval F0 = 1; u1 = F0*(t1 - sin(t1)); u2 = F0*(2*pi -t2 - 3*sin(t2)); u3 = F0*(-4*sin(t3)); % calculate derivatives in each interval up1 = F0*(1 - cos(t1)); up2 = F0*(-1 - 3*cos(t2)); up3 = F0*(-4*cos(t3)); % plot line graph of u(t) figure(1); subplot(2,1,1); hold on plot(t1,u1,'b') plot(t2,u2,'r') plot(t3,u3,'b') % plot 3 IVs for each interval plot(0,0,'bx') plot(pi,F0*pi,'rx') plot(2*pi,0,'bx') axis([0 6*pi -5*F0 5*F0]); % label plot ("\bf"-prefix makes text boldface) title(['\bf the continuous solution for #3.9.15']) xlabel('\bf t-axis') ylabel('\bf u(t)-axis') text(pi/2,2,'x''s mark IVs for each interval') % plot line graph of u'(t) subplot(2,1,2); hold on plot(t1,up1,'b') plot(t2,up2,'r') plot(t3,up3,'b') % plot 3 IVs for each interval plot(0,0,'bx') plot(pi,F0*2,'rx') plot(2*pi,-F0*4,'bx') axis([0 6*pi -5*F0 5*F0]); % label plot ("\bf"-prefix makes text boldface) title(['\bf the continuous derivative for #3.9.15']) xlabel('\bf t-axis') ylabel('\bf u''(t)-axis') text(pi/2,4,'x''s mark IVs for each interval')