Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
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