Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In MATLAB can you write this code 3. Pursuit problem. Suppose a rabbit follows a predefined path r(t) = (1.1 cos(t),sin(t)). A fox, initially at

In MATLAB can you write this code

3. Pursuit problem. Suppose a rabbit follows a predefined path r(t) = (1.1 cos(t),sin(t)). A fox, initially at y(0) = (0, 0), chases the rabbit in such a way that at each moment the fox the runs toward the rabbit with a constant speed k. That is, the path of the fox, y(t), is determined by the ODE dy(t) dt = k r(t) ? y(t) kr(t) ? y(t)k , where k k denotes the length (i.e. 2-norm) of a vector. Obviously, this equation is ill-defined if the distance kr(t) ? y(t)k = 0. Thus we consider that the fox captures the rabbit if this distance is very close to 0.

(a) Develop a script (P3.m) and necessary functions to solve this problem. Set the events function properly such that the solver ode45 terminates once the distance kr(t) ? y(t)k reaches 10?5 . To avoid the failure of the ode solver, you also need to set other options (eg. error tolerance and/or step size) properly.

(b) Run your code with k = 1.1 and find the time instant when capture occurs. Generate a graph showing the trajectories of the rabbit and the fox. Add the initial positions and where the rabbit is captured as symbols. Properly annotate your plot.

(c) The fox is not supposed to capture the rabbit if k ? 1. Verify this by running your code with k = 0.9 for t ? 20. Generate a graph showing the trajectories.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions