BARNESN Barnes smoothing interpolation of unstructured data
Vq = BARNESN(X, V, Xv) returns the smoothing interpolation of
D-dimensional observations V(X) at query points Xq. Query points Xq are
created by meshing the vectors in the cell array Xv that define the
grid in each dimension. Smoothing interpolation is performed using
the Koch form of Barnes objective analysis . Roughly, (in 2D) the
interpolated value (vq) at gridpoint (xq, yq) is determined as a
weighted-sum of the values (v) at data points (x, y), based on the
gaussian weighting function exp(-r^2 / s / g^j), where r is the
euclidian distance from (xq, yq) to (x, y), s is the Gaussian Variance,
and g is the Convergence Parameter.
 Barnes, Stanley L. "Mesoscale objective map analysis using weighted
time-series observations." (1973)
 Koch, Steven E., Mary DesJardins, and Paul J. Kocin. "An
interactive Barnes objective map analysis scheme for use with
satellite and conventional data." Journal of Climate and Applied
Meteorology 22.9 (1983): 1487-1503.
 Daley, Roger. Atmospheric data anlysis. No. 2. Cambridge University
See documentation/help for more information.
Lena Bartell (2023). Barnes interpolation (Barnes objective analysis) (https://www.mathworks.com/matlabcentral/fileexchange/58937-barnes-interpolation-barnes-objective-analysis), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Inspired by: Barnes objective analysis
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Update to appropriately handle the situation wherein some data points lie outside the grid (previously this just produced NaNs).
Fixed some errors in the algorithm implementation and implemented optimal parameters as default. Expanded functionality from 2D to N-dimensions.
Corrected typo in example implementation