B = smoothdata(A)
B = smoothdata(A, method)
B = smoothdata(A, method, window)
B = smoothdata(A, dim)
B = smoothdata(A, dim, method)
B = smoothdata(A, dim, method, window)
B = smoothdata(__, nanflag)
B = smoothdata(__, Name, Value)
[B, window] = smoothdata(__)
| Parameter | Description |
|---|---|
| A | input vector or matrix: numeric or logical. |
| method | a character vector or string: smoothing method. See the description for the list of supported methods. |
| window | a positive scalar or a two-element vector [back forward]: moving window length. |
| dim | dimension to operate along: positive integer scalar. |
| nanflag | a character vector or string: 'omitnan' (default) or 'includenan'. |
| Name, Value | parameter name/value pairs: 'SamplePoints', 'SmoothingFactor', 'Degree'. |
| Parameter | Description |
|---|---|
| B | smoothed data. |
| window | moving window length used for the smoothing. |
smoothdata smooths noisy data in a vector or in the columns of a matrix.
By default, smoothdata operates along the first non-singleton dimension using the 'movmean' method and a heuristic window length chosen from the data.
The supported values of method are:
'movmean': moving average over each window (default).
'movmedian': moving median over each window.
'gaussian': moving weighted average with Gaussian weights.
'lowess': local regression using a first-degree polynomial.
'loess': local regression using a second-degree polynomial.
'sgolay': Savitzky-Golay polynomial filter (use 'Degree' to set the polynomial degree, default 2).
The 'omitnan' flag (default) ignores NaN values inside each window, while 'includenan' propagates them.
'SmoothingFactor' is a scalar between 0 and 1 that tunes the automatically chosen window length; larger values give more smoothing.
'SamplePoints' is a vector of uniformly spaced sample coordinates; the window is then expressed in the units of these coordinates.
The robust methods 'rlowess' and 'rloess' are not supported yet.
A = [1 2 10 4 5];
B = smoothdata(A, 'movmean', 3)
A = [1 2 10 4 5];
B = smoothdata(A, 'gaussian', 3)
A = [1 2 10 4 5];
[B, window] = smoothdata(A)
| Version | Description |
|---|---|
| 2.0.0 | initial version |