%
%  code3Mb.m -- 16 sept 02 -- djm
%  (code1Fa.m -- 06 sept 02 -- djm)
%

%  clear workspace & graphics

clear;  close all

%  set t & v grid matrices ("help meshgrid")

x = -3.125:0.25:3.125;  y = -3.125:0.25:3.125;
[xx,yy] = meshgrid(x,y);

%  calculate tangent vectors (dt,dv)

dx = ones(size(xx));  dy = 0.5*(3*xx.^2 + 4*xx +2)./(yy-1);
ds = sqrt(dx.^2 + dy.^2);

%  plot tangent vectors ("help quiver") 

figure(1);  hold on
quiver(xx,yy, dx./ds, dy./ds,0.3,'k')
quiver(xx,yy,-dx./ds,-dy./ds,0.3,'k.')
plot(xx(:),yy(:),'r.')
axis([-3 3 -3 3]);

%  label plot

title(['\bf tangent vectors (figure 2.2.2) - vectors scaled to equal length'])
xlabel('x-axis')
ylabel('y-axis')

