Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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 arc 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 104). 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 arc 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 104). 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

More Books

Students also viewed these Databases questions

Question

=+What do they need to hear?

Answered: 1 week ago

Question

3. How would you address the problems that make up the situation?

Answered: 1 week ago

Question

2. What recommendations will you make to the city council?

Answered: 1 week ago