profile: [ ] (all profiles default).
direction: up, down (default) or both.
threshold: 2 (default).
windowLength: 3 (default).
action: NaN (default), replace, or interp.
visualize: show plot with original, processed and flagged data on specified profile(s)
spike: spike indices
This function removes or replaces spikes in the data from the
channel specified. The algorithm used here is to discard points that lie outside of a threshold. The data are smoothed by a median filter of length
windowLength to produce a "reference" time series. Residuals are formed by subtracting the reference time series from the original time series. Residuals that fall outside of a
threshold, specified as the number of standard deviations, where the standard deviation is computed from the residuals, are flagged for removal or replacement.
The default behaviour is to replace the flagged values with NaNs. Flagged values can also be replaced with reference values, or replaced with values linearly interpolated from neighbouring "good" values.
[rsk, spike] = RSKdespike(rsk,'channel','Temperature','profile',3:5,'direction','down','threshold',4,'windowLength',11,'action','nan');
The red circles indicate the samples in the blue time series that are spikes.