Question: Write a MATLAB script that simulates a squirrel randomly foraging for an acorn using a 2D-random walk. The foraging area for the squirrel is a

Write a MATLAB script that simulates a squirrel randomly foraging for an acorn using a 2D-random walk. The foraging area for the squirrel is a 10 x 10 square grid (which the squirrel never leaves), with the acorn located in a single cell within the grid.

Your script should:

1. Animate the random walk.

2. Calculate the total distance traveled before finding the acorn.

3. Determine the average total distance traveled before acorn discovery for 1,000 simulated walks

4. Display a histogram for the total distance traveled before acorn discovery for 1,000 simulated walks.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!