% main2b.m

global w
y0 = [60;70];  % initial conditions, starting point of the dog
w = 10;        % w  speed of the dog
options= odeset('RelTol',1e-5,'Events','on');
[t,Y] = ode23('dog1',[0,20],y0,options);
clf; hold on;
axis([-10,70,-10,70]); % 100 -> 70 S,B.
plot(Y(:,1),Y(:,2))
J=[];
for h= 1: length(t),
   w  = jogger1(t(h));
   J = [J; w'];
end;
plot(J(:,1), J(:,2),':');
p = max(size(Y));
cross(Y(p,1),Y(p,2),2)
hold off;
