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