Question: Write MATLAB code that exactly simulates a random walk on G of length 104. The walk starts at vertex 1. At each step of the

 Write MATLAB code that exactly simulates a random walk on G

Write MATLAB code that exactly simulates a random walk on G of length 104. The walk starts at vertex 1. At each step of the walk, all outgoing arcs for the given vertex have the same probability to be chosen. To choose the next are that the walk will follow, use MATLAB function randi for generating random integers in a given interval. Do not use any linear algebra in part (f). It must be clear at which vertex the walk arrives in each step, but do not print this information. Keep count of the number of times each vertex is visited. After completing 104 steps of the walk, compute the vector F of relative frequencies with which each vertex was visited on this particular walk (that is, the number of visits divided by 10%). The entries of F are numbers in the interval [0, 1]. According to the theory studied this week, there ought to be a good agreement be- tween the vectors S and F. In Figure 2, plot both vectors S and F using a double- bar plot. To see how to do that, read section "Display Groups of Bars" on the page https://www.mathworks.com/help/matlab/ref/bar.html. Remember to attach an in- formative title and legend to the plot. Write MATLAB code that exactly simulates a random walk on G of length 104. The walk starts at vertex 1. At each step of the walk, all outgoing arcs for the given vertex have the same probability to be chosen. To choose the next are that the walk will follow, use MATLAB function randi for generating random integers in a given interval. Do not use any linear algebra in part (f). It must be clear at which vertex the walk arrives in each step, but do not print this information. Keep count of the number of times each vertex is visited. After completing 104 steps of the walk, compute the vector F of relative frequencies with which each vertex was visited on this particular walk (that is, the number of visits divided by 10%). The entries of F are numbers in the interval [0, 1]. According to the theory studied this week, there ought to be a good agreement be- tween the vectors S and F. In Figure 2, plot both vectors S and F using a double- bar plot. To see how to do that, read section "Display Groups of Bars" on the page https://www.mathworks.com/help/matlab/ref/bar.html. Remember to attach an in- formative title and legend to the plot

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!