Question: 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
Get step-by-step solutions from verified subject matter experts
