Question: Exercise 1 Write a matlab function that generates a one-dimensional random walk. The random walker starts from the origin x = 0 and at each

 Exercise 1 Write a matlab function that generates a one-dimensional random

Exercise 1 Write a matlab function that generates a one-dimensional random walk. The random walker starts from the origin x = 0 and at each discrete step jumps 1 unit distance to the right or left with probabilities pR and pl=1-pR, respectively. The input variables to the matlab function are the probability pR and the number of steps (N), and the output is a single vector containing all the positions of the walker after each step. Start your function with the line 1function walk = randomWalk(PR,N) Show/hide hint Check your code visually by running it and plotting the output random walk trajectory i.e. position vs time. Use different values of pR and N: the symmetric case pR=pL=0.5, pR = 0.7 and PR=0.4, for 10, 100 and 1000 iterations. Submit your M-file for your random walk generator below: Choose file No file chosen Upload your M-file 0%

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!