DSPRelated.com
Forums

Find periodicity of a signal

Started by sia4uin July 1, 2015
Hello All

I have two signals and I want to know which signal is more periodic than
other. My approach:

1. Make both signals zero mean.
2. Take FFT of both signals.
3. Take sum of squared values of the output FFT within a band of 0.8 Hz to
2.6 Hz

If the sum of first signal is high then the signal 1 is more periodic.

This approach works but only 90% time. I need the success rate to be
100%.

How can I improve the algorithm?

Best Regards

Sia
---------------------------------------
Posted through http://www.DSPRelated.com
sia4uin <105263@dsprelated> wrote:

> I have two signals and I want to know which signal is more periodic than > other. My approach:
> 1. Make both signals zero mean. > 2. Take FFT of both signals. > 3. Take sum of squared values of the output FFT within a band > of 0.8 Hz to 2.6 Hz
Mathematically, a signal is either periodic or it isn't. There isn't any periodic continuum. So, you need to define what you mean, and once you do the signals will follow that.
> If the sum of first signal is high then the signal 1 is more periodic. > This approach works but only 90% time. I need the success rate to be > 100%.
So a signal could be a perfect sine at 2.7Hz and would score zero? You don't say how long the FFT is, but that could have a big effect on the result. A signal perfectly periodic, and even between 0.8 and 2.6Hz, but not an exact multiple of the fundamental for your FFT will score low. I suspect on of the popular window methods would help here. But even more obvious, you have zero mean, but no restriction after that. You should at least normalize the amplitude in some way, such as RMS. -- glen
>Mathematically, a signal is either periodic or it isn't. >There isn't any periodic continuum. > >So, you need to define what you mean, and once you do the >signals will follow that. > >> If the sum of first signal is high then the signal 1 is more periodic. >> This approach works but only 90% time. I need the success rate to be >> 100%. > >So a signal could be a perfect sine at 2.7Hz and would score zero? > >You don't say how long the FFT is, but that could have a >big effect on the result. A signal perfectly periodic, and even >between 0.8 and 2.6Hz, but not an exact multiple of the fundamental >for your FFT will score low. I suspect on of the popular window >methods would help here. > >But even more obvious, you have zero mean, but no restriction >after that. You should at least normalize the amplitude in >some way, such as RMS. > > >-- glen
Thank you for your reply Glen. The reason is that the frequency content that I am looking for will be in the range of 0.8 Hz to 2.6 Hz. I am working on pedometer algorithms and the two signals are Pitch (in Deg) and z-Acceleration (in m/s^2). The range indicates human walking frequency. There are some cases where the pitch is more periodic than the acceleration and vice versa, I have seen it when I plot two signals together. I can normalise the signals so that the norm of the signals is 1 and the FFT size is 512 samples, I cannot go more than that as the sampling frequency is 25 Hz. The steps I described above works, most of the time but in few cases, although I can see that the pitch is periodic, the above steps tell me that acceleration is periodic. --------------------------------------- Posted through http://www.DSPRelated.com
On Wednesday, July 1, 2015 at 11:29:56 AM UTC-4, sia4uin wrote:
> Hello All > > I have two signals and I want to know which signal is more periodic than > other. My approach: > > 1. Make both signals zero mean. > 2. Take FFT of both signals. > 3. Take sum of squared values of the output FFT within a band of 0.8 Hz to > 2.6 Hz > > If the sum of first signal is high then the signal 1 is more periodic. > > This approach works but only 90% time. I need the success rate to be > 100%. > > How can I improve the algorithm? > > Best Regards > > Sia > --------------------------------------- > Posted through http://www.DSPRelated.com
This is as good as it gets: http://www.google.com/patents/US7124075 http://translate.google.com/translate?hl=en&sl=ru&u=http://www.gamedev.ru/flame/forum/%3Fid%3D134654&prev=search Other than this - conventional autocorrelation or AMDF And forget about FFT
sia4uin <105263@dsprelated> wrote:
 
(snip, I wrote)
>>So, you need to define what you mean, and once you do the >>signals will follow that.
>>> If the sum of first signal is high then the signal 1 is more periodic. >>> This approach works but only 90% time. I need the success rate to be >>> 100%.
>>So a signal could be a perfect sine at 2.7Hz and would score zero?
(snip)
> The reason is that the frequency content that I am looking for will be in > the range of 0.8 Hz to 2.6 Hz. I am working on pedometer algorithms and > the two signals are Pitch (in Deg) and z-Acceleration (in m/s^2). The > range indicates human walking frequency.
OK, that makes it a lot more obvious. You want to know how good someone is at keeping a consistent pace. Say you take one point on each cycle, maybe a zero crossing in one direction. Filter enough so that there is only one per cycle. So, no transforms to consider, just how consistent the spacing it. You could, for example, compute the standard deviation of the time between steps (zero crossings). You could also do some more closely related to autocorrelation. I think autocorrelation could be considered a continuous measure of periodicity, in that it considers the whole cycle.
> There are some cases where the pitch is more periodic than the > acceleration and vice versa, I have seen it when I plot two signals > together.
-- glen
On 7/1/15 12:14 PM, glen herrmannsfeldt wrote:
> sia4uin<105263@dsprelated> wrote: > >> I have two signals and I want to know which signal is more periodic than >> other. My approach: > >> 1. Make both signals zero mean. >> 2. Take FFT of both signals. >> 3. Take sum of squared values of the output FFT within a band >> of 0.8 Hz to 2.6 Hz > > Mathematically, a signal is either periodic or it isn't. > There isn't any periodic continuum.
well, it all depends on definitions, glen. we can certainly define a measure of the degree of periodicity that is equal to 1 when it is periodic and less than 1 when it isn't (and very nearly 1 when it "appears" in some sense to be very nearly periodic).
> So, you need to define what you mean, and once you do the > signals will follow that.
i guess we both said that. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
robert bristow-johnson  <rbj@audioimagination.com> wrote:

>On 7/1/15 12:14 PM, glen herrmannsfeldt wrote:
>> Mathematically, a signal is either periodic or it isn't. >> There isn't any periodic continuum.
>well, it all depends on definitions, glen. we can certainly define a >measure of the degree of periodicity that is equal to 1 when it is >periodic and less than 1 when it isn't (and very nearly 1 when it >"appears" in some sense to be very nearly periodic).
I think a natural measure of how close a non-periodic signal is to being periodic would be based on RMS error, i.e. for power signals let X(t) = P(t) + e(t) where X is the signal of interest, and P is a periodic signal that minimizes the power of e(t). If the ratio of the power of e(t) to the power of X(t) is small, then X() is close to being periodic. Steve
On 7/9/15 9:34 PM, Steve Pope wrote:
> robert bristow-johnson<rbj@audioimagination.com> wrote: > >> On 7/1/15 12:14 PM, glen herrmannsfeldt wrote: > >>> Mathematically, a signal is either periodic or it isn't. >>> There isn't any periodic continuum. > >> well, it all depends on definitions, glen. we can certainly define a >> measure of the degree of periodicity that is equal to 1 when it is >> periodic and less than 1 when it isn't (and very nearly 1 when it >> "appears" in some sense to be very nearly periodic). > > I think a natural measure of how close a non-periodic signal is to > being periodic would be based on RMS error, i.e. for power signals let > > x(t) = p(t) + e(t) > > where x(t) is the signal of interest, and p(t) is a periodic signal that > minimizes the power of e(t). If the ratio of the power of e(t) to > the power of x(t) is small, then x(t) is close to being periodic.
yup, you gotta make sure that e(t) is uncorrelated with p(t). then if the power of p(t), which is smaller than the power of x(t), is close to the power of x(t), then x(t) is close to periodic. this comes out as the values of the ASDF (referring to the power of e(t)) or the autocorrelation function (referring to the power of p(t)) and are two sides of the same coin. the ASDF and autocorrelation are upside-down versions of each other. one will minimize exactly at the same lag where the other will maximize. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."