0
$\begingroup$

Say I have a periodic signal i.e. Sine wave, which sometimes can have spikes that are 100% larger than the peak value. These spikes can be periodic as well. I'm trying to find an algorithm that could detect these spikes without human intervention. I was thinking for each point to average the value with the surrounding 3 or more points but it doesn't seem to be working. Any help is appreciated.

$\endgroup$
  • $\begingroup$ you could approach this a lot of ways. do you know the frequency of your steady sin? $\endgroup$ – Stanley Pawlukiewicz Aug 17 at 12:37
  • $\begingroup$ If the spikes are so much larger than your signal, why not simply use a threshold comparison? ( If signal > threshold then mark surrounding +- X seconds as spike). $\endgroup$ – JLo Aug 19 at 5:38
0
$\begingroup$

My suggestion would be to plot the frequency response by taking the FFT of a reasonable length to see the spectrum. Apart from the two spikes in FFT output (corresponding to sinewave) you could see the DFT of the periodic spur signal with approximate amplitude of $N$ where $N$ is the period of the combined signal. The DFT of spur is a constant amplitude signal, which means, for all FFT bins, it will be constant value. If your signal is noisy, you could easily average out these values to find the amplitude of spur. You should first subtract amplitude of sinewave from the FFT before computing this. Here is the code I tried

clc
clear all
n=0:9999;
x = sin(pi/5*n);
spike = repmat([1 zeros(1,9)],1,1000);
x1 = x + spike;
plot(abs(fftshift(fft(x1,1000))))

I got the amplitude of spur signal to be $N/N_{fft}$.FFT Output

$\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.