The important part is that they need to be vectors . Yours are arrays .
However,
so each j iteration, you generate a bunch of forward random motions (no negative offsets when there should be), and add them to the current locations, giving updated locations.
then you take the last set of random values and put it at the top of the set of random variables ?? So x would become (2*n, t) in size after the first round. And then you tell MATLAB to pull xtrack out of memory, and get it ready for displaying, but then not to display it because of the semi-colon; you do not store into xtrack.
Then you do something similar for y, and proceed to the plot, which fails. The scatter() I post above will get past that.
Now you loop back, and x is 2*n by t in size, and you generate new random values of size n by t. Then you try to add the (2*n by t) array and the (n by t) array... which is going to fail.
I would suggest to you that if you have 300 molecules to track, that it is not necessary to generate 300 different random matrices of size 300 x 100 per time step
Best Answer