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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started