Question: In a three - dimensional random walk, the position ( x , y , z ) of a walker at step j is computed by:
In a threedimensional random walk, the position x y z of a walker at step j is computed
by: xj xjDelta x yj yjDelta y and zj zjDelta z where Delta xDelta y and Delta z are random numbers
that determine the length and direction of each step. Assume that the walker starts at the
origin, and keeps taking steps each of random length and direction until they step outside of
a boundary. The boundary is a sphere of radius R centered at the origin.
a Write a Matlab script mfile that calculates the number of steps required for the walker
to reach the boundary. Use Matlabs builtin function randn to calculate Delta xDelta y and
Delta z Run the program times using a loop and calculate the average number of steps
needed to reach the boundary. Output the results to the user.
b Write a Matlab script mfile that creates a threedimensional plot of a single random
walk. Use Matlabs builtin function randn to calculate Delta xDelta y and Delta z Use
Matlabs builtin function plot to create the plot. Be sure to add a title and axis labels to
the plot.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
