# Removing very big peaks in a signal

I am analyzing a signal where I want to extract the peaks based on a threshold. My problem here is that there are some noise artifacts very high that are messing with my signal. I want to remove them but I don't know which is the best way to do so.

Any suggestions or recommendations to avoid those peaks?

• what about simply looking for values whose abs() > 500? Apr 3, 2022 at 10:37
• @Brethlosze not following you; the amplitude is exactly what makes spikes, no? Apr 3, 2022 at 11:17
• I want to remove the peaks above 300 microvolts (that's the amplitude units) which are the peaks in the circle. Apr 3, 2022 at 14:01
• Could you please add some information on their cause, how they differ from what you want to detect, and maybe show a zoom? May 3, 2022 at 13:07
• Well, I could remove them by 1) inspection of peaks, 2) inspection of isolated peaks (regions without many peaks, set arbitrarly) and 3) check the std. If the std is lower than the overall std, then I remove the peak. May 5, 2022 at 0:18

This question lack some critical information so perhaps this answer is not definitive.

In the following, we asume a discrete time t with a sampling time dt.

Cumulated Value

Sometimes, what you need to measure is the cumulated value, approximated in discrete time this is just an integral. This is not a relevant method, but consider the expression for the following. $$x_f(t)=x_f(t-dt)+dtx(t)\\ x_f(t)\approx \int_0^t x(\tau) d\tau$$

Detect a Low Pass Magnitude

You have a reason to go with a low pass filter. Note how you increased $$dt$$ into a greater but still small quantity $$b<1$$, with $$b=(1-a)$$. This simply impose a forgetting factor as we are having a first order filter. $$x_f(t)=ax_f(t-dt)+(1-a)x(t)\\ x_f(t)\approx \int_0^t x(\tau)e^{-at} d\tau$$

Detect a Windowed Magnitude

If your peaks are due to outliers events, the Energy would be the best way to go, but the cumulative previous sense could be too much. In here, applying the Low Pass can help. Also, you can apply a window, if a time interval $$T$$ have some meaning for the process behind your application. $$x_f(t)=x_f(t-dt)+dtx(t)-dtx(t-T)\\ x_f(t)\approx \int_{t-T}^t x(\tau) d\tau$$

Detect Energy

If the squared measured variable has a physical meaning, you can use it as filtered quantity to assess your detection. In some cases (voltage, current, pressure, sound, displacement, velocity), it is related to some form of energy. When using the squared variable, you are calculating a cumulative RMS with $$t$$ the window. Remember the RMS relates to the standard deviation $$\sigma$$ if your signal is normalized in mean. $$x_{f}(t)={t-dt \over t}x_{f}(t-dt)+ {dt \over t} x^2(t)\\ RMS^2_t\{x(t)\}=x_{f}(t)\approx \frac 1 t \int_0^t x^2(\tau) d\tau\\ \sigma^2={t \over t-dt} RMS^2_t\{x(t)\} \approx RMS^2_t\{x(t)\}$$

Other Magnitudes

Finally, some combinations of the previous can be useful for applying a threshold on your auxiliary variable. Please add in the comments how your process works for the previous magnitudes.

$$e(t)=[x_f(t)>x_0]$$