Wednesday, 10 August 2016

frequency - How do I determine if a discrete signal is periodic or not?


I want to know how I can determine whether a series of data is periodic or not.


I want to use Fourier transform/series. My data looks either aperiodic



[111100001111000110010101010000101]



or periodic



[11001100110011001100]




and I need to decide which it is automatically. What types of analyses or calculations can I perform to determine if a signal is periodic or not?



Answer



I would do a normalized autocorrelation to determine periodicity. If it is periodic with period $P$ you should see peaks at every $P$ samples in the result. A normalized result of "1" implies perfect periodicity, "0" implies no periodicity at all at that period, and values in between imply imperfect periodicity. Subtract the data sequence's mean from the data sequence before doing the autocorrelation because it will bias the results.


The peaks will tend to diminish the farther away from the center they get simply because of having fewer overlapping samples. You can mitigate that effect by multiplying the results by the inverse of the percentage of overlapping samples.


$$ U(n) = A(n) * \frac{N}{\lvert N-n\rvert} $$ where $U(n)$ is the un-biased autocorrelation, $A(n)$ is the normalized autocorrelation, $n$ is the offset, and $N$ is the number of samples in the data sequence that you are checking for periodicity.


EDIT: This is an example of how to tell if the sequences are periodic. The following is Matlab code.


s1 = [1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 0 0 1 0 1 0 1 0 1 0 0 0 0 1 0 1];
s1n = s1 - mean(s1);
plot(xcorr(s1n, 'unbiased'))


The "unbiased" parameter to the xcorr function tells it to do the scaling described in my equation above. The auto-correlation is not normalized, though, which is why the peak at the center is around 0.25 instead of 1. That doesn't matter, though, as long as we keep in mind that the center peak is perfect correlation. We see that there are no other corresponding peaks except at the outermost edges. Those do not matter because there there is only one sample overlapping, so that is not meaningful.


Non-periodic


s2 = [1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0];
s2n = s2 - mean(s2);
plot(xcorr(s2n, 'unbiased'))

Here we see that the sequence is periodic because there are multiple unbiased autocorrelation peaks with the same magnitude as the center peak.


Periodic


No comments:

Post a Comment

readings - Appending 内 to a company name is read ない or うち?

For example, if I say マイクロソフト内のパートナーシップは強いです, is the 内 here read as うち or ない? Answer 「内」 in the form: 「Proper Noun + 内」 is always read 「ない...