gridbinreturns the mean value of all scattered data points within every cell of a grid rather than interpolating or fitting a surface.
gridbinis much faster than
gridbincan handle much larger scattered datasets than
gridbincan return statistics. For example,
gridbincan return the standard deviation of all scattered data points within a grid cell simply by adding
@stdto the function call.
vq = gridbin(x,y,v,xq,yq) vq = gridbin(...,@func) [vq,N] = gridbin(...)
vq = gridbin(x,y,v,xq,yq) produces a 2D grid of values vq at the coordinates
xq,yq. Inputs x,y,v may be scattered data, and the output vq is the mean
of all scattered values v within each spatial bin.
vq = gridbin(...,@func) applies any function @func to the v data. By
default, @func is @mean, meaning that vq contains the mean of all values
v within each spatial bin.
[vq,N] = gridbin(...) also returns a grid N containing the number of
observations v in each bin.
Chad Greene (2022). gridbin (https://github.com/chadagreene/gridbin), GitHub. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Inspired by: Surface Fitting using gridfit
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!