Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3. (15 points) Create a function X = run-walk(z0, PT) that takes as input an initial condition x(0) E RN, a transition matrix P of
3. (15 points) Create a function X = run-walk(z0, PT) that takes as input an initial condition x(0) E RN, a transition matrix P of size N N, and the number of time steps T > 0. As output, the function returns a matrix X = [x(0),x(1), . . . , X(7-1)] of size N T so that each column contains x-P1x program by allocating memory for X before going into a for loop. For example, you can write X = zeros((N,T)), and then replace the zeros with the actual ualues of x(t) (T-1) Hint: Improve the speed of your To test your function, consider the transition matrix P associated with the adjacency matrix 0 1 0 1 Let x(0-11,0,0,0]T and plot 2 (t) as a function of t E {0,1, , 15) for each i {1, 2, 3, 4), all in the same plot(ie., there will be 4 curves in the plot). Make a second plot by repeating the simulation for a different graph: the graph one obtained by removing the self edges in the adjacency matrix above (i.e., set A11 A44 0). Comment on your observations
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