# Detecting and removing interferences from a signal

I am using MATLAB in order to denoise and remove interferences on a signal.

I used wdenoise to denoise my signal which works by setting a threshold (for example SURE) for each scale and set all coefficients below this threshold to zero (these coefficients represents noise). It works pretty well.

I also wanted to detect interferences, which are in my case like spikes (most of the time with high amplitude compared to the useful signal), and remove them. I try to use wavelet decomposition (wavedec) to detect theses spikes and set a threshold to identify them for each scale. If a coefficient is greater than this threshold, I consider that this is an interference coefficient so I set it to zero. Let's consider a decomposition of 8 level. Because of downsampling, make a threshold on D{8} for example, give me a signal with only 10 coefficients so it's very complicated to see what coefficient is an interference coefficient.

With this technique, I don't have great results. Any idea to reconstruct a signal with spikes? Maybe other techniques ? Maybe used swt or modwt instead of wavedec ?

I'd recommend using a median filter to smooth your signal. A median filter will get rid of the outliers, or the spikes in your signal. The length of the median filter will have to be determined by how frequently the spikes appear in your signal. The median filter is available in Python as numpy.median.