<p>The instantaneous frequency of a wave is defined as $f(t) = \frac{1}{2\pi}\frac{d\phi}{dt}$ where $\phi$ is the instantaneous phase. See the Wikipedia page on <a href="http://en.wikipedia.org/wiki/Instantaneous_frequency#section_2" rel="nofollow">Instantaneous Frequency</a>.</p>

<p>Presumably you have discrete data, in which case you need to estimate $\phi$ and its derivative numerically. </p>

<p>This isn't an entirely meaningful measure, since it doesn't make very much sense to ascribe a frequency to a non-periodic function, but nonetheless there does seem to be a convention for it.</p>

<p>Let me close by saying that I don't consider this a TCS problem. It is firmly in signal processing territory, and so I wouldn't consider here the ideal venue for such questions.</p>

CC BY-SA 3.0
2012-06-04T00:58:20.683Z
2012-06-06T03:31:36.773Z
2012-06-06T03:31:36.773Z
Joe Fitzsimons
<p>There is <em>no such thing</em> as the instantaneous period of a wave.  The Heisenberg uncertainty principle guarantees this.  Oh you can find a set of estimated frequencies for a given window over the signal, but that is frequencies for the whole window, not for <em>that instant</em>.   You need to figure out what size of time-frequency window satisfies your needs and then calculate something the Fourier transform for that window over the entire signal (and maybe search the resulting frequencies for the peak).</p>

<p>Two things to remember, the larger the window, the higher the frequency resolution (how many frequencies you can see), but the smaller the time resolution (when something happened--and this is a bit hard to explain as it's been a few years since I've had to learn and deal with it extensively so I may not be saying it right). </p>

<p>Another factor is that amplitude (multiplication in the time domain) is convolution in the frequency domain.  To remove some artifacts of that you may have to do some filtering (that is, convolution in the <em>time</em> domain or multiplication in the frequency domain.)  It might even make sense to filter with one widow size then do analysis with another window size.  There's a lot of finicky business when it comes down to signal sampling.</p>

<p>Edit:</p>

<p>Ok, this "Heisenberg uncertainty principle" with regard to signal sampling is not some random thing I pulled out of my ear one day.  It is, AFAIK, a well established concept within Wavelet literature.  (Wavelets involve a whole family of mathematical non-Fourier techniques to analyze a signal)  "The World According to Wavelets: The Story of a Mathematical Technique in the Making" by Barbra Burke Hubbard (ISBN 1-56881-072-5) devotes at least one (if not two) chapters to the subject and has a proof in the Appendices.  </p>

<p>According to her, (I'm going to have to paraphrase as my attempts to translate to Mathjax/TeX/LaTeX are failing, please also forgive as it's been years since I've looked at this anyway)  For every $f(t)$ ($t$ a real number) such that the integral (from negative infinity to positive infinity) of $|f(t)|^2$ with respect to $t$  equals $1$, the product of the variance of $t$ and the variance of $\tau$ (the variable of $\hat f$) is at least $1/(16*\pi^2)$, and then gives a large, explicit inequality to state what exactly she means with further non mathematical explanation throughout the chapter.</p>

<p>I will make no attempt to explain further, partially for fear I'd likely mess up. But if you want, you can read that and/or its references and see that, yes, the Heisenberg uncertainty principle <strong>does indeed</strong> apply here.</p>

CC BY-SA 3.0
2012-06-04T00:35:05.667Z
This has absolutely nothing to do with the Heisenberg uncertainty principle.
Joe Fitzsimons
CC BY-SA 3.0
2012-06-05T17:41:17.587Z
@JoeFitzsimons: I'm as annoyed as you are at people bringing up a bunch of quantum nonsense in situations that have nothing to do with tiny subatomic particles. However, in this case, finding a frequency with the [Fourier transform](http://en.wikipedia.org/wiki/Fourier_transform#Uncertainty_principle) actually does have something to do with the Heisenberg uncertainty principle, so I'm giving JayC a +1 point.
David Cary
CC BY-SA 3.0
2012-06-05T23:04:00.390Z
@JoeFitzsimons: AFAIK, it absolutely does, please see edits.  We're not talking about particles or waves of nature here, we're talking about some fundamental limits of any function (which may define a signal) with regard to variances.  I'm not claiming anything new here.  I'll admit, even with my last edits, there is a certain lack of clarity, due to my ignorance.
JayC
CC BY-SA 3.0
2012-06-06T04:01:39.323Z
JayC and @DavidCary: I'm not suggesting I haven't seen this claim before, simply that it is wrong. The Heisenberg uncertainty principle is a statement about the existence of non-commuting observables in quantum mechanics. People sometimes like to draw an analogy signal processing, but in signal processing the observables do commute. The analogy is used because signals aren't necessarily of a defined frequency or position, which is similar to the quantum case where the quantum state is not an eigenstate of the measurement.
Joe Fitzsimons
CC BY-SA 3.0
2012-06-06T04:02:03.613Z
But it is only that, an analogy. In particular you can make both position and frequency measurements of a classical waveform without disturbing it. Thus [p,x]=0, counter to the quantum case. By the way, the -1 didn't come from me, as I thought the rest of the answer was okay.
Joe Fitzsimons
CC BY-SA 3.0
2012-06-06T04:12:29.633Z
Sorry, "it is" in the first comment seems to have gotten mangled to "Otis".
Joe Fitzsimons
CC BY-SA 3.0
2012-06-06T05:00:42.793Z
my impression is that what JayC and @DavidCary are referring to is the fact that no function is simultaneously concentrated in the time and frequency domains. however, this is unrelated afaik to the existence/definability of "instantaneous frequency": it just means that a signal which resembles a single "pulse" is "spread out" in the Fourier domain
Sasho Nikolov
CC BY-SA 3.0
2012-06-06T05:34:03.670Z
@Sasho: Yes, I agree, both that this is what they likely meant, and that it is unrelated to the instantaneous frequency. However, it is also not a consequence of the Heisenberg uncertainty principle, they are simply analogous situations.
Joe Fitzsimons
CC BY-SA 3.0
2012-06-07T18:04:36.157Z
@JoeFitzsimons: The most popular ways of making frequency measurements on a long series of numbers (perhaps stored as a .WAV file) all use the Fourier transform. There is an ["uncertainty"](http://en.wikipedia.org/wiki/Fourier_transform#Uncertainty_principle) associated with using the Fourier transform to make time/frequency measurements. In quantum mechanics, ["The position-space and momentum-space wave functions are Fourier transforms of each other"](http://en.wikipedia.org/wiki/Wave_function#Relation_between_wavefunctions). The properties of the Fourier transform are the same in both cases.
David Cary
CC BY-SA 3.0
2012-06-08T05:06:47.817Z
@DavidCary:  This is nothing to do with Heisenberg uncertainty, it is simply an artifact of the fact that a general wave form has neither position nor frequency and you are trying to shoehorn it in to one category or the other.
Joe Fitzsimons
CC BY-SA 3.0
2012-06-08T05:14:58.383Z
The comment about the Fourier transform is also misleading, as it is not the same Fourier transform in both cases.
Joe Fitzsimons
CC BY-SA 3.0
2012-06-08T16:02:49.373Z
@JoeFitzsimons: I have to admit I find your arguments are quite tenable.  Indeed, "it is simply an artifact of the fact that a general wave form has neither position nor frequency and you are trying to shoehorn it in to one category or the other" was my whole intended original point, and I guess I shouldn't have brought up Heisenberg Uncertainty.  But I do find it shocking that I've certainly read (or at least scanned) at least two upper math level texts and several blog posts relating the time-space frequency to HU.  Maybe it's only appropriate to use as an analogy, but ... (continued)
JayC
CC BY-SA 3.0
2012-06-08T16:14:54.113Z
... besides the fact that HU deals with quantum mechanics (and perhaps other points mentioned) , I have to wonder where the analogy explicitly fails, and why it is worth arguing the point.  I'm trying to figure out where I and others may have been lead wrong.  Is this a little white lie that Wavelet experts have been telling because it's just so good to explain time-frequency resolution with wavelets, or is there some fatal flaw somewhere?
JayC
CC BY-SA 3.0
2012-06-08T16:37:24.683Z
@JayC: There is something called the Gabor limit in signal processing, which is a consequence of some theorems related to the uncertainty principle, but not a direct consequence of the uncertainty principle itself, which say that you can't simultaneously localize the value of a function and its Fourier transform. The consequence for signal processing is that you can't simultaneously filter tightly in both position and frequency domains. The filtering is mathematically similar to the effect of a projective measurement in quantum mechanics, and so you see similar results.
Joe Fitzsimons
CC BY-SA 3.0
2012-06-08T16:44:34.953Z
However, even given the above, you use the Heisenberg uncertainty principle above is in the context of measurement, which is not the same as filtering. A classical measurement does not apply a projection operator (like a filter based on the output), unlike quantum measurements, thus the measurements commute and so there is no uncertainty principle. It may be true that there is a relationship between variances which looks similar to the quantum case, but this would no longer bare any reasonable relationship to the original Heisenberg uncertainty principle.
Joe Fitzsimons
CC BY-SA 3.0
2012-06-14T04:00:23.883Z
@JoeFitzsimons, JayC: I fear we're drifting off-topic -- perhaps ["In Fourier transforms, can momentum space be analogized to frequency, and position space be analogized to wavelength?"](http://dsp.stackexchange.com/questions/157/in-fourier-transforms-can-momentum-space-be-analogized-to-frequency-and-positi) would be a better place for discussing Heisenberg, etc.
David Cary
CC BY-SA 3.0
2012-05-04T15:04:44.603Z
2012-06-05T22:51:10.047Z
2012-06-05T22:51:10.047Z
JayC
<p>I have a set of data which represents slightly imperfect waves of varying amplitudes and periods. I wish to calculate the instantaneous period of the wave around any point within this data set - simply finding the local minima and maxima representing each individual wave and calculating the frequency of these is not precise enough for my needs.</p>

<p>Is there a known algorithm that can achieve this? Even better, an existing implementation of this algorithm? I am currently programming in R, but am willing to switch if needed.</p>

<p>n.b. if this is the wrong StackExchange site for this question, please direct me to a better one.</p>

CC BY-SA 3.0
2012-05-02T16:00:45.013Z
stats.SE might be better.
Suresh Venkat
CC BY-SA 3.0
2012-05-02T17:36:54.540Z
probably more suitable for [stats.se] or [scicomp.se].
Kaveh
CC BY-SA 3.0
2012-06-03T18:12:04.807Z
[question](http://stats.stackexchange.com/q/27625/2003) on [stats.se]
Kaveh
<ds.algorithms>
Calculating the instantaneous period of a wave
Ina
# Calculating the instantaneous period of a wave

(Asked by: username_0 on 2012-05-02)

I have a set of data which represents slightly imperfect waves of varying amplitudes and periods. I wish to calculate the instantaneous period of the wave around any point within this data set - simply finding the local minima and maxima representing each individual wave and calculating the frequency of these is not precise enough for my needs.

Is there a known algorithm that can achieve this? Even better, an existing implementation of this algorithm? I am currently programming in R, but am willing to switch if needed.

n.b. if this is the wrong StackExchange site for this question, please direct me to a better one.

**Tags:** ds.algorithms
> **Comments:**
> **username_1**: stats.SE might be better.  
> **username_2**: probably more suitable for [stats.se] or [scicomp.se].  
> **username_2**: [question](http://stats.stackexchange.com/q/27625/2003) on [stats.se]  

---

## 2 answers

### Answer by username_3 on 2012-06-04. Score: 2

The instantaneous frequency of a wave is defined as $f(t) = \frac{1}{2\pi}\frac{d\phi}{dt}$ where $\phi$ is the instantaneous phase. See the Wikipedia page on [Instantaneous Frequency](http://en.wikipedia.org/wiki/Instantaneous_frequency#section_2).

Presumably you have discrete data, in which case you need to estimate $\phi$ and its derivative numerically.

This isn't an entirely meaningful measure, since it doesn't make very much sense to ascribe a frequency to a non-periodic function, but nonetheless there does seem to be a convention for it.

Let me close by saying that I don't consider this a TCS problem. It is firmly in signal processing territory, and so I wouldn't consider here the ideal venue for such questions.


---

### Answer by username_4 on 2012-05-04. Score: -2

There is *no such thing* as the instantaneous period of a wave. The Heisenberg uncertainty principle guarantees this. Oh you can find a set of estimated frequencies for a given window over the signal, but that is frequencies for the whole window, not for *that instant*. You need to figure out what size of time-frequency window satisfies your needs and then calculate something the Fourier transform for that window over the entire signal (and maybe search the resulting frequencies for the peak).

Two things to remember, the larger the window, the higher the frequency resolution (how many frequencies you can see), but the smaller the time resolution (when something happened--and this is a bit hard to explain as it's been a few years since I've had to learn and deal with it extensively so I may not be saying it right).

Another factor is that amplitude (multiplication in the time domain) is convolution in the frequency domain. To remove some artifacts of that you may have to do some filtering (that is, convolution in the *time* domain or multiplication in the frequency domain.) It might even make sense to filter with one widow size then do analysis with another window size. There's a lot of finicky business when it comes down to signal sampling.

Edit:

Ok, this "Heisenberg uncertainty principle" with regard to signal sampling is not some random thing I pulled out of my ear one day. It is, AFAIK, a well established concept within Wavelet literature. (Wavelets involve a whole family of mathematical non-Fourier techniques to analyze a signal) "The World According to Wavelets: The Story of a Mathematical Technique in the Making" by Barbra Burke Hubbard (ISBN 1-56881-072-5) devotes at least one (if not two) chapters to the subject and has a proof in the Appendices.

According to her, (I'm going to have to paraphrase as my attempts to translate to Mathjax/TeX/LaTeX are failing, please also forgive as it's been years since I've looked at this anyway) For every $f(t)$ ($t$ a real number) such that the integral (from negative infinity to positive infinity) of $|f(t)|^2$ with respect to $t$ equals $1$, the product of the variance of $t$ and the variance of $\tau$ (the variable of $\hat f$) is at least $1/(16\*\pi^2)$, and then gives a large, explicit inequality to state what exactly she means with further non mathematical explanation throughout the chapter.

I will make no attempt to explain further, partially for fear I'd likely mess up. But if you want, you can read that and/or its references and see that, yes, the Heisenberg uncertainty principle **does indeed** apply here.

> **Comments:**
> **username_3**: This has absolutely nothing to do with the Heisenberg uncertainty principle.  
> **username_5**: @JoeFitzsimons: I'm as annoyed as you are at people bringing up a bunch of quantum nonsense in situations that have nothing to do with tiny subatomic particles. However, in this case, finding a frequency with the [Fourier transform](http://en.wikipedia.org/wiki/Fourier_transform#Uncertainty_principle) actually does have something to do with the Heisenberg uncertainty principle, so I'm giving JayC a +1 point.  
> **username_4**: @JoeFitzsimons: AFAIK, it absolutely does, please see edits.  We're not talking about particles or waves of nature here, we're talking about some fundamental limits of any function (which may define a signal) with regard to variances.  I'm not claiming anything new here.  I'll admit, even with my last edits, there is a certain lack of clarity, due to my ignorance.  
> **username_3**: JayC and @DavidCary: I'm not suggesting I haven't seen this claim before, simply that it is wrong. The Heisenberg uncertainty principle is a statement about the existence of non-commuting observables in quantum mechanics. People sometimes like to draw an analogy signal processing, but in signal processing the observables do commute. The analogy is used because signals aren't necessarily of a defined frequency or position, which is similar to the quantum case where the quantum state is not an eigenstate of the measurement.  
> **username_3**: But it is only that, an analogy. In particular you can make both position and frequency measurements of a classical waveform without disturbing it. Thus [p,x]=0, counter to the quantum case. By the way, the -1 didn't come from me, as I thought the rest of the answer was okay.  
> **username_3**: Sorry, "it is" in the first comment seems to have gotten mangled to "Otis".  
> **username_6**: my impression is that what JayC and @DavidCary are referring to is the fact that no function is simultaneously concentrated in the time and frequency domains. however, this is unrelated afaik to the existence/definability of "instantaneous frequency": it just means that a signal which resembles a single "pulse" is "spread out" in the Fourier domain  
> **username_3**: @Sasho: Yes, I agree, both that this is what they likely meant, and that it is unrelated to the instantaneous frequency. However, it is also not a consequence of the Heisenberg uncertainty principle, they are simply analogous situations.  
> **username_5**: @JoeFitzsimons: The most popular ways of making frequency measurements on a long series of numbers (perhaps stored as a .WAV file) all use the Fourier transform. There is an ["uncertainty"](http://en.wikipedia.org/wiki/Fourier_transform#Uncertainty_principle) associated with using the Fourier transform to make time/frequency measurements. In quantum mechanics, ["The position-space and momentum-space wave functions are Fourier transforms of each other"](http://en.wikipedia.org/wiki/Wave_function#Relation_between_wavefunctions). The properties of the Fourier transform are the same in both cases.  
> **username_3**: @DavidCary:  This is nothing to do with Heisenberg uncertainty, it is simply an artifact of the fact that a general wave form has neither position nor frequency and you are trying to shoehorn it in to one category or the other.  
> **username_3**: The comment about the Fourier transform is also misleading, as it is not the same Fourier transform in both cases.  
> **username_4**: @JoeFitzsimons: I have to admit I find your arguments are quite tenable.  Indeed, "it is simply an artifact of the fact that a general wave form has neither position nor frequency and you are trying to shoehorn it in to one category or the other" was my whole intended original point, and I guess I shouldn't have brought up Heisenberg Uncertainty.  But I do find it shocking that I've certainly read (or at least scanned) at least two upper math level texts and several blog posts relating the time-space frequency to HU.  Maybe it's only appropriate to use as an analogy, but ... (continued)  
> **username_4**: ... besides the fact that HU deals with quantum mechanics (and perhaps other points mentioned) , I have to wonder where the analogy explicitly fails, and why it is worth arguing the point.  I'm trying to figure out where I and others may have been lead wrong.  Is this a little white lie that Wavelet experts have been telling because it's just so good to explain time-frequency resolution with wavelets, or is there some fatal flaw somewhere?  
> **username_3**: @JayC: There is something called the Gabor limit in signal processing, which is a consequence of some theorems related to the uncertainty principle, but not a direct consequence of the uncertainty principle itself, which say that you can't simultaneously localize the value of a function and its Fourier transform. The consequence for signal processing is that you can't simultaneously filter tightly in both position and frequency domains. The filtering is mathematically similar to the effect of a projective measurement in quantum mechanics, and so you see similar results.  
> **username_3**: However, even given the above, you use the Heisenberg uncertainty principle above is in the context of measurement, which is not the same as filtering. A classical measurement does not apply a projection operator (like a filter based on the output), unlike quantum measurements, thus the measurements commute and so there is no uncertainty principle. It may be true that there is a relationship between variances which looks similar to the quantum case, but this would no longer bare any reasonable relationship to the original Heisenberg uncertainty principle.  
> **username_5**: @JoeFitzsimons, JayC: I fear we're drifting off-topic -- perhaps ["In Fourier transforms, can momentum space be analogized to frequency, and position space be analogized to wavelength?"](http://dsp.stackexchange.com/questions/157/in-fourier-transforms-can-momentum-space-be-analogized-to-frequency-and-positi) would be a better place for discussing Heisenberg, etc.  

---

