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 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

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_2

Step: 3

blur-text-image_3

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

Object Databases The Essentials

Authors: Mary E. S. Loomis

1st Edition

020156341X, 978-0201563412

More Books

Students also viewed these Databases questions

Question

7. Identify four antecedents that influence intercultural contact.

Answered: 1 week ago

Question

5. Describe the relationship between history and identity.

Answered: 1 week ago