Question: Module 7 Code: Exercise 1 Write a Matlab function that uses your Matlab random walk function from Module 7 to generate a collection of trajectories

Module 7 Code:

Exercise 1 Write a Matlab function that uses your Matlab random walk function from Module 7 to generate a collection of trajectories with fixed parameters, where the inputs are the number of time steps N, the probability of right step pR, and the number of runs NRuns; and the output is the final position zf of the walker after the N steps. You will be required to submit a M-file Exercise 2 Investigate the output by plotting a histogram of the final positions (use hist() in Matlab). Describe how the shape histogram can be increased from the default value when NRuns is large.) Enter description function walk randomWalk( pR,N walk zeros (1,N+1) ; Efor i-2:N+1 x-rand O; walk(i)-walk(i-1) +1: else walk(i)-walk(i-1)-1: end end end
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
