Question: * it says my Xm value is wrong... can someone help my MATLAB code * write a script that generates a 1 D random walk

*it says my Xm value is wrong... can someone help my MATLAB code*
write a script that generates a 1D random walk for N=20000 markers. In the
beginning, the markers are randomly distributed in the interval (-3,3). Generate
these initial positions and store them in x0.
Each step, the position x of each marker should change by a randomly picked
number in the interval (-1,1). All markers make Nt=75 steps. The result (x-
positions) should be stored in an array called Xm. Do NOT store the initial position
in Xm. Your script should be vectorized.
IMPORTANT: the size of Xm should be Nt by N.
Script o.
Nt=75;
N=20000;
x0=rand(1,N)**6-3;
step_changes =randi([-1,1],Nt,N);
xm= cumsum(step_changes, 1)+x0;
size(xm)
 *it says my Xm value is wrong... can someone help my

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!