Question: Using MATLAB, write a code for the random walk of the walker: A random walk in two dimensions: Write a program, rw2d.m, to describe a
Using MATLAB, write a code for the random walk of the walker:![]()
A random walk in two dimensions: Write a program, rw2d.m, to describe a walker making a random walk with unit steps in the x-y plane. The walker starts at the origin. Represent the walkers N position using MATLAB arrays x and y. A good starting value for total number of random walks would be 1000. The walk starts with x(1) = 0, y(1) = 0. Use a for loop to calculate the walker's moves. At each step the walker uses a random number to decide whether to take step: bullet North (y increases by 1; x stays the same). bullet South (y decrease by 1; x stays the same). bullet East (x increases by 1; y stays the same). bullet West (x decreases by 1; y stays the same). The walker always takes a step of length 1. Please plot the trajectory of the random walk
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
