Reduces spikes in measured signals.



y = shave(x)

y = shave(x,factor,Wn,lolim,uplim)


This function is used for reducing spikes in a measured signal. The spikes are shaved using the method in [1].

If no output argument is specified, a figure containing the original signal and shaved signal is drawn. The figure also contains the band (see "Algorithm" below). Detected spikes are indicated with crosses.


x is the signal to be shaved.

factor is the (optional) multiplication factor which determines the width of the detection band. When the detection is poor, this factor should be changed. The default value is 2.

Wn is the (optional) cut-off frequency of the low-pass filter used for trend determination. It must be in the range 0.0 < Wn < 1.0, with 1.0 corresponding to half the sample rate. Its default value is 0.01.

lolim,uplim (optional) The signal x will be clipped to the band [lolim,up_lim] before the shaving starts.


y is the shaved signal.


The spike removal algorithm developed in [1] is used. This algorithm can be summarized as follows:

Used By

This is a top-level function that is used directly by the user.


[1] A. Backx, Identification of an Industrial Process: A Markov Parameter Approach. PhD thesis, University of Eindhoven, Eindhoven, The Netherlands, 1987.