RSKsmooth.m

Arguments

Input

 -Required- 

  • RSK 
  • channel : longName of a single channel or a cell array for multiple channels.

-Optional- 

  • filter : boxcar (default), triangle or median.
  • profile : [ ] (all profiles, default).
  • direction : down, up or both.
  • windowLength : 3 (default)
  • visualize: show plot with original and processed data on specified profile(s)

Output

  • RSK

This function applies a low-pass filter to a specified channel or multiple channels with a running average or median. The sample being evaluated is always in the centre of the filtering window to avoid phase distortion. Edge effects are handled by mirroring the original time series.

The windowLength argument determines the degree of smoothing. If windowLength = 5; the filter is composed of two samples from either side of the evaluated sample and the sample itself.  windowLength must be odd to centre the average value within the window.

The median filter is less sensitive to extremes (best for spike removal), whereas the boxcar and triangle filters are more effective at noise reduction and smoothing.

The figures below demonstrate the effect of the different available filters.

The effect of the various low-pass filters implemented by RSKsmooth on a step function.
Note that in this case the median filter leaves the original step signal unchanged.



Example of the effect of various low-pass filters on a time series.


Example:

rsk = RSKsmooth(rsk, 'channel', {'Temperature', 'Salinity'}, 'windowLength', 17)