%
%  code1Fa.m -- 06 sept 02 -- djm
%

%  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 (example 1)'])
xlabel('t-axis')
ylabel('v-axis')

%  plot solutions for C = 8, -4 , -5*exp(2/5)

t1 = -1:0.1:11;  

C =  8;           v1 = 49 + C*exp(-t/5);
C = -4;           v2 = 49 + C*exp(-t/5);
C = -5*exp(2/5);  v3 = 49 + C*exp(-t/5);

plot(t,v1,'b');  text(3,55,'C=8')
plot(t,v2,'b');  text(1,47,'C=-4')
plot(t,v3,'g');  text(5,45,'C=-5 exp(2/5)')

