version 2.3 (9.47 KB) by Damien Garcia
SMOOTHN allows automatized and robust smoothing in arbitrary dimension w/wo missing values


Updated 20 Jun 2020

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

SMOOTHN provides a fast, unsupervised and robust discretized spline smoother for data of arbitrary dimension.

SMOOTHN(Y) automatically smoothes the uniformly-sampled array Y. Y can be any N-D multicomponent noisy array (e.g. time series, images, 3D data, 3D vector fields, tensors...).

To smooth a vector field or multi-component data, Y must be a cell array. For example, if you need to smooth a 3-D vectorial flow (Vx,Vy,Vz), use Y = {Vx,Vy,Vz}. The output Z is also a cell array which contains the smoothed components.

SMOOTHN can deal with missing (NaN) values (see screenshot and examples).

SMOOTHN(...,'robust') carries out a robust smoothing that minimizes the influence of outlying data (see screenshot and examples).

SMOOTHN is made unsupervised by the minimization of the generalized cross-validation score.

Enter "help smoothn" in the Matlab command window for complete instructions and 1-D to 3-D examples.

A series of 8 documented examples is available here:

When using this algorithm, please refer to these 2 papers:
1) Garcia D. Robust smoothing of gridded data in one and higher dimensions with missing values.
Comput Statist Data Anal, 2010;54:1167-1178
2) Garcia D. A fast all-in-one method for automated post-processing of PIV data.
Exp Fluids, 2011;50:1247-1259.

Cite As

Damien Garcia (2022). smoothn (, MATLAB Central File Exchange. Retrieved .

Garcia, Damien. “Robust Smoothing of Gridded Data in One and Higher Dimensions with Missing Values.” Computational Statistics & Data Analysis, vol. 54, no. 4, Elsevier BV, Apr. 2010, pp. 1167–78, doi:10.1016/j.csda.2009.09.020.

View more styles

Garcia, Damien. “A Fast All-in-One Method for Automated Post-Processing of PIV Data.” Experiments in Fluids, vol. 50, no. 5, Springer Science and Business Media LLC, Oct. 2010, pp. 1247–59, doi:10.1007/s00348-010-0985-y.

View more styles
MATLAB Release Compatibility
Created with R2017a
Compatible with R2017a to R2020a
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!