3
$\begingroup$

This signal represents a drawn line. For some reason, the device showed interference as shown in the figure below: enter image description here The question is: how can I remove the interference, making the signal as continuous as possible?

Any suggestions?

$\endgroup$
  • 5
    $\begingroup$ A median filter should remove most glitches, but not the final burst in your signal. $\endgroup$ – Juancho Feb 22 '17 at 7:05
0
$\begingroup$

Most of the noise you've circled looks like impulsive noise meaning a small number of sudden impulses or spikes. You can remove this reliably with an impulse rejection filter. The response of this filter is usually defined as $$ y_k = \left\{ \begin{array}{cc} x_k, & |x_k - m_k| \le t S_k \\ m_k, & |x_k - m_k| > t S_k \end{array} \right. $$ Here, $m_k$ is the median of a window centered on sample $x_k$, and $S_k$ is a robust scale estimate of the same window, such as the median absolute deviation (MAD). The choice of the MAD as the scale estimate is also known as the Hampel filter in the statistics literature, though you can choose other scale estimates, such as IQR, $S_n$, $Q_n$ etc.

$t$ is a tuning parameter indicating how many scale estimates away from the median are allowed before flagging the point as an outlier, or impulse. If the current sample is less than $t$ scales away from the local median, the filter does nothing. Otherwise it replaced the sample with the local median.

In Matlab there is a routine called hampel which will do this for you. I believe R has a similar function.

The advantage of this filter over other suggestions (median filter, lowpass frequency domain filter) is that the impulse rejection filter only modifies samples identified as outliers while the other filters will modify every sample in your signal, outlier or not.

The jump at the right edge of your signal will require different methods, depending how you want to handle it.

$\endgroup$
0
$\begingroup$

It looks like you are plotting a histogram, which is basically an estimate of a probability mass or probability density function. Maybe this is not correct. If your x-axis label is wrong, and this is truly a signal as a function of time, then what you are looking for is an estimation of the actual signal given additive noise. A simpler solution is a frequency-based low-pass filter. People can provide more answers if they know the nature of the signal in your graph.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.