Clear Filters
Clear Filters

Counting number of particles in each position

1 view (last 30 days)
Ok , so I have an array conatining particle trajectories from a random walk in which each column is a particle trajectory and it looks something like this for example
r = [1 3 4 5 6; 0 3 1 2 4; 2 4 5 6 7]
The particles have a fixed step and my goal is to find the number of particles in each possible position in every step in a very efficient way. I want to do this outside the for loop that generates the particle trajectories. I have a row vector conatining the possible particle positions for example
possteps = 1:10;
I want to use the approach used in this anwer
but I am having trouble implementing it so that i get the particle counts for every step (for every row in r)
If anyone has any suggestions on how to do did effiiently for big arrays of r and possteps I would be very grateful.

Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!