% chase.m % global a b m c w % transmit path and speed information to fkt a = 30; b = 30; % semi-axes of ellipse m = [0;0]; % center c = 17.58940018; % constant speed of target w = 18.5; % speed of robot % % set graphics window to accept input % axis equal; axis ([-40 40 -40 40]); [Initial_Data(1), Initial_Data(2)] = ginput (1); % mouse is used to identify intial robot position Initial_Data(3) = 0; %initial time % % set up parameters for differential equation % timelimit = 20; % final time framerate = 16; % in frames per second for movie tspan = linspace (0, timelimit, timelimit*framerate+1); options= odeset('AbsTol',1e-5,'Events','on'); [t,robot]= ode45 ('fkt', tspan, Initial_Data, options); nframes = length(t); % number of output points target = zeros(p, 2); % initialize array for target % % compue target position % target(:, 1)= m(1)+a*cos(robot(:,3)); target(:, 2)= m(2)+b*sin(robot(:,3));