Specify grid of cells and compute/plot values inside

1 visualización (últimos 30 días)
Hugo Calisto
Hugo Calisto el 19 de Mayo de 2023
Comentada: Hugo Calisto el 22 de Mayo de 2023
I have a scatter of (x,y) coordinates with an associated velocity value.
I need to specify a grid of cells of “n” vertical and “m” horizontal elements, compute the average velocity in each cell, plot the grid on the (x, y) plane colored by average cell velocity, and finally export the grid of velocity values.
I assume there is a straightforward way of grouping the (x,y,v) values in each (m,n) cell (I heard about binning although I am not familiar with the tools) and computing the average cell velocity.
Any thoughts and hints would be most welcome.
Thank you in advance.

Respuesta aceptada

Walter Roberson
Walter Roberson el 19 de Mayo de 2023
Generally speaking:
You can discretize the coordinates independently, to get bin numbers along the x and y axes.
Then you can consider using those bin numbers as group numbers for grpstats .
Or you can use the bin numbers as coordinates (first parameter) for accumarray with the corresponding velocities as the second parameter, and specify the function mean (watch out, function does not go in the third parameter.)

Más respuestas (0)

Categorías

Más información sobre Scatter Plots en Help Center y File Exchange.

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by