Seeking an efficient method for using 'scatter3' to create a 3D scatter plot of fixed receiver positions.
3 views (last 30 days)
I wish to represent a 3D array of reciever positions as dots - see attached plot for the general idea (I won't share the shameful code used to generate it, haha). My intention is to then animate the plot by representing each position's signal amplitude by its corresponding dot's colour (each sample generates a new plot/frame). I've successfully animated plots of a 2D plane of receiever positions, with amplitude on Z-axis, so I'll cross any issues with that bridge once I've had a good attempt myself, but I welcome any quick tips or relevant docs people may have about sending the time dimension data to the figure's colour info.
My only question at this stage is actually about how to most effieciently plot a 3D "block" of dots (as below) according to specified dimensions - basically - in very broad terms - to input 3 x 3 x 3 and get something resembling the attached image (or any three dimensions for that matter). The solution is almost guaranteed to be embarassingly simple, but it has eluded me so far (I've been ill, so my concentration is totally shot, which hasn't helped).
Many thanks in advance for any advice, tips, links or hints, etc.
Max Heiken on 13 Jul 2021
I think you are looking for meshgrid.
[y, x, z] = meshgrid(1:3, 1:3, 1:3);
scatter3(x(:), y(:), z(:), , amplitude(:), 'o', 'filled');
Notice that it is [y, x, z] and not [x, y, z], it is a quirk of the meshgrid function.