% % code1Fa.m -- 06 sept 02 -- djm % % - to run, type "code1Fa" at the matlab prompt ">>" % clear workspace & graphics clear; close all % set t & v grid matrices ("help meshgrid") t = 0:1:10; v = 40:1:60; [tt,vv] = meshgrid(t,v); % calculate tangent vectors (dt,dv) dt = ones(size(tt)); dv = 9.8 - vv/5; % plot tangent vectors ("help quiver") figure(1); hold on quiver(tt,vv, dt, dv,0.5,'k') quiver(tt,vv,-dt,-dv,0.5,'k.') plot(tt(:),vv(:),'r.') axis([-0.5 10.5 39 61]); % label plot title(['tangent vectors (figure 1.1.2)']) xlabel('t-axis') ylabel('v-axis') disp('hit return to continue') pause % plot ODE solution through (2,44) t1 = -1:0.1:11; v1 = 49 - 5*exp((2-t)/5); plot(t,v1,'g')