0

This one is really giving me a headache...

I have a dataset consisting of X groups of particles each with some group-specific properties. Each of these groups contain a certain amount of particles with a given velocity distribution and each particle flies in a certain direction. I'm keeping track of the position of the particles as a function of time. Now, I want to make some meaningful visualizations out of this data.

For the case of simplicity, let's assume the velocities have been binned into N bins and the number of particles per velocity bin is always the same. Furthermore, let's assume I'm only looking at the absolute distance w.r.t. origin (i.e. position becomes a single value).

I have the position data for this simplified case stored for T timesteps in a 3D array (T x N x X). I have already discretized my position data such that all values are now points on a equidistant grid. Now I'm looking to visualize e.g. the total number of particles at every position at a given time using e.g. hist3 or surf.

Basically, all I want to do is count the number of occurrences of each discrete position for every timestep. While I could simply loop over the timesteps to get my counts, I'm hoping there is a more elegant solution to tackle this!

slvrbld
  • 103
  • 4

1 Answers1

0

For collecting the data, you can use the function histcounts at each timestep, specifying your discrete bins as the 'edges'.

[N,edges] = histcounts(X,edges)

On plotting the data, I don't think you'll be able to plot T x N x X as a 3-D plot, because you have four variable (Time, Velocity, Group, Position). You could split the visualization into plots per group, for which you could do a surface plot of the Position count for Each Time / Velocity combination.

DMR
  • 1,479
  • 1
  • 8
  • 11
  • Yes, that's what I'm currently doing. Was hoping for something more elegant for direct manipulation so that I can avoid storing all the intermediate data, but I guess I'll have to settle with either adding analysis in my time-loop or looping over the results afterwards. Thanks nonetheless! – slvrbld May 11 '18 at 17:19