Take the 2-minute tour ×
Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. It's 100% free, no registration required.

I would like to evaluate frequency of some unstable periodic signal coming from a detector:

signal started period zoom

The signal is registered continuously and may or may not be present (i.e. be periodic). The frequency and amplitude of the periodic signal can change but stays in some certain range. The shape of the periodic signal is more or less the same as shown on the second image. It may sometimes have distortions of higher amplitude and frequency.

I need to check 1) if there is a periodic signal and 2) what frequency it has.

Is there any good way to do it?


Edit 1:

I am not sure if FFT is reliable in this case. What do you think?

Frequency spectrum for all data points:

enter image description here

Spectrum with last 512 points

enter image description here

The spectra were calculated using Octave (online) based on example from Matlab site

N = 512; % length(all_data)
x = all_data(1:N);
Fs = N;
xdft = fft(x);
xdft = xdft(1:N/2+1);
psdx = (1/(Fs*N)).*abs(xdft).^2;
psdx(2:end-1) = 2*psdx(2:end-1);
freq = 0:Fs/length(x):Fs/2;
plot(freq,10*log10(psdx));
share|improve this question
add comment

2 Answers 2

The signal looks like narrow band noise and may not be periodic at all. The FFT will generally reveal a periodic signal that is in the presence of some noise.

In the FFT results, if you have a periodic signal, you should see peaks at the fundamental and its harmonics. If the "periodic" signal is unstable (modulated in some way) the peaks will become less distinct.

You can try different window functions on your data to see if more defined harmonic peaks become visible in the FFT data. For example compare results using a number of windows such as Gaussian and Blackman-Harris windows.

Also the choice of the window size (length of data) used when computing the FFT will affect your frequency resolution (bin spacing). If you can roughly estimate the period of the signal, choose a data length that is a multiple of the estimated period so the bins line up with the signal harmonics. In general a longer data set will provide better frequency resolution than a shorter data set, so if you don't know the period of the signal, go with a longer data set.

share|improve this answer
add comment

Thanks for uploading your data. It looks like there is a fairly strong periodic component with frequency $~0.042 \approx 1/24$ (in rough agreement with your first plot):

enter image description here

Generated with Mathematica:

x = ReadList["Desktop/raw.txt"];
y = Abs@Fourier@Standardize[ x, Mean];
ListLinePlot[y[[1 ;; Round[0.15 Length@y]]], Filling -> Axis, PlotRange -> All, DataRange -> {0, 0.15}]

edit for MSalters:

Let's take a closer look at the first part, up to sample 1375:

z = Fourier@Standardize[x[[1 ;; 1375]], Mean]

enter image description here

We see that the impulse near the origin is gone. Then let's smooth its frequency spectrum:

ListLinePlot[Part[Abs@z /. s_ /; s < 3 :> 0, 1 ;; Round[0.08 Length@z]], PlotRange -> { {0, .08}, {0, 10}}, DataRange -> {0, .08}]

enter image description here

Finally, let's convert this filtered spectrum back into the time domain:

xrec = InverseFourier[z /. s_ /; Abs@s < 3 :> 0];
ListLinePlot[xrec - Min@xrec]

enter image description here

We see the characteristic multimodal peaks of the original signal.

share|improve this answer
    
The smaller peaks at ~0.02 and ~0.06 do not appear where you'd expect the harmonics, though. –  MSalters Jan 21 '13 at 15:39
    
I think some of them are harmonics, and some are not. –  Emre Jan 22 '13 at 17:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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