Functions > Data Analysis > Smoothing > Median Smoothing
Median Smoothing
medsmooth(v, [n], [m])—Returns a smoothed vector by replacing each value in v with the median of the n points centered on that value. The window width, n, is contracted near the ends of the vector.
The medsmooth function performs median filtering. It is the most robust of the smoothing functions since it is least likely to be affected by spurious data points. It does, however, tend to rub out sharp features in the data. You may wish to compare this method with Gaussian Kernel smoothing or localized least-squares smoothing. The loess polynomial regression technique is also an effective smoother.
VSmooth(v, w)—Performs repeated median smoothing of v until no additional change occurs for each window width in w. Convergence of the smoothing depends on TOL.
v is an array of real numbers.
n and m are optional with default value = 3.
If v is a 1D vector argument, you can only set n. In this case, argument m is not applicable.
If v is a 2D matrix argument, you can either set n only for a square window (n = m) or set both n and m for a rectangular window.
w is a vector of window-widths. Elements of w must be nonnegative, odd integers smaller than the length of v.
Was this helpful?