I am trying to do the complex trace analysis of a seismic trace in Matlab where I need to calculate the instantaneous frequency of a discrete signal. I have used the formula according to Barnes. I am running an algorithm where I need to iteratively run complex trace analysis on the residual trace obtained after subtracting a matching wavelet from this trace. Though the formula gives me the results for lower frequencies <50 Hz, it does not give the right results for >60 Hz. I am not able to understand why this is happening. Can someone please tell me the reason behind this and how to do this correctly?

  • $\begingroup$ The link is broken. $\endgroup$
    – Matt L.
    Commented Apr 18, 2014 at 12:30
  • 1
    $\begingroup$ Please define "instantaneous frequency". I thought the uncertainty principle implied that such a thing doesn't exist. $\endgroup$ Commented Apr 18, 2014 at 12:53
  • 1
    $\begingroup$ You may have more luck getting helpful feedback if you 1) post a working reference link, and 2) include some of your code. $\endgroup$
    – dpbont
    Commented Apr 18, 2014 at 13:24
  • 1
    $\begingroup$ I fixed the link. $\endgroup$
    – Jason R
    Commented Apr 18, 2014 at 15:24
  • 1
    $\begingroup$ @SouzanAmirabadi Welcome to SE.SP! Please do not post new questions as answers. Your question, as stated, is probably off-topic for the site because we don't allow questions asking for code written to a specification. We might sometimes write code in answering a signal processing question, but that is a different thing and secondary to answering the signal processing question. This site is about answering signal processing questions, not coding requests. A simple google search for "instantaneous frequency python" shows several implementations. Try one of those. $\endgroup$
    – Peter K.
    Commented Oct 25, 2022 at 12:59

5 Answers 5


If this thread's still checked on: a modern approach is synchrosqueezing. Brief comments:

  • Instantaneous amplitude and frequency (AM/FM in short) decomposition is non-unique. Any method that suggests otherwise makes assumptions - for something simple like the analytic signal via Hilbert transform, it will fail in most cases.
  • For multi-component signals, to get meaningful results, we need to extract multiple AM/FM. This requires component separation. A "component" is a curve in time-frequency we can draw without lifting our hand.

For some illustration, pasting from another answer:

  1. Non-uniqueness AM example:

$$ \cos(A)\cos(B) = .5[\cos(A+B) + \cos (A - B)] $$

  1. No single linear transform can perfectly decompose all AM-FM signals, due to the uncertainty principle. In time-frequency analysis, our chosen kernel will have a certain time or frequency resolution that can handle some signals but not others. Extremes example, what excels at time localization will be terrible at multi-component separation:

enter image description here


If a signal consists of a single component and has the form $f(t) = A(t) e^{2πiφ(t)}$, then $A(t) = |f(t)|$ is its amplitude, $φ(t) = \arg(f(t))/2π$ is its phase, and its instantaneous frequency is the time derivative of the phase $ν_f(t) = φ'(t)$. As such, it satisfies the identity $$|f(t)|^2 ν_f(t) = \overline{f(t)} \left({1\over{4πi}}\overleftrightarrow{d\over dt}\right) f(t),$$ where $\overleftrightarrow{d/dt}$ denotes $d/dt$ applied to the right, minus $d/dt$ applied to the left - a standard notation in the physics literature. Alternatively, and equivalently, it's the imaginary part of $(1/2π) d/dt \ln f(t)$.

The spectrum for the signal will be a line which resides at frequency $ν_f(t)$ at time $t$, with an intensity proportional to $A(t)$.

If a signal consists of multiple components, then they each need to be separated out first. An example can be seen here


Notice, in particular, what happens when the voice and tone overrun each other - there's a collision of the two at around 17 seconds in the video. A sufficient (but not necessary) condition to separate out the components is that their corresponding instantaneous spectra not be colliding like that. If they're not colliding, then they can be each be separately filtered out, and the single-component definition applied to each one. If they are colliding, then you need to find another way to separate them first (a kind of intelligent "unmixing" algorithm that unmixes even the places where they overlap). An example vividly displaying that kind of separation is here


(The scalogram, however, continues to depict the mixed sound. I don't show the separation there, it's only shown in the spectrogram.)

  • 1
    $\begingroup$ You say "$f(t) = A(t) e^{2\pi\varphi(t)}$", then you say $A(t) = |f(t)|^2$. I don't think that is true if $\varphi$ is real. I think it needs a square root in there. $\endgroup$ Commented Aug 13, 2022 at 2:48
  • $\begingroup$ There is no requirement generally to separate out the components. Instantaneous frequency is simply the time derivative of the phase— so the multiple components will “collide” and produce an instantaneous frequency accordingly. What is required is an analytic signal representation. For audio (which I am much less familiar with) I am not sure we can say that an analytic signal representation would always exist in any meaningful way? $\endgroup$ Commented Aug 13, 2022 at 11:34
  • $\begingroup$ @DanBoschen I don't follow your commentary. If your approach works in general, how can it fail for audio? The analytic signal fails to extract AM or FM for multi-component signals, they must be separated. That, or we're redefining AM/FM in a way we probably don't want - $A(t)$ and $\phi(t)$ become arbitrary functions and mostly meaningless. $\endgroup$ Commented Aug 13, 2022 at 11:54
  • $\begingroup$ @OverLordGoldDragon it is the time derivative of phase; that is a given definition with no caveats- whether that is meaningful to us for audio applications I am not sure of what that application will be. For any application with modulation it is quite meaningful with no other constraints as mentioned in the other answers. Regardless the definition holds in all cases. $\endgroup$ Commented Aug 13, 2022 at 12:19
  • $\begingroup$ I see here example of its use for audio as well: towardsdatascience.com/…. $\endgroup$ Commented Aug 13, 2022 at 12:26

Matlab has a function you might find useful: instfreq

There are two methods available:

  • one uses the phase derivative of the analytical signal (computed through a Hilbert transform).
  • the other uses spectral moments of the power spectrum.

You could compare the output of your code with the Hilbert + phase method since that's what is used in the paper you linked.


Instantaneous frequency is a poorly defined concept over wide-band (single channel) data, but can be a useful estimation given narrow-band signals of sufficient duration. One trick for using an instantaneous frequency estimation algorithm which is usefully accurate only in one frequency band is to resample (or modulate) your data to move the frequency band of interest into the bandpass of the algorithm. You may need to bandpass filter your data before resampling (modulating) so that the source band ends up entirely within the algorithm's bandwidth. The bandpass filter can then reject noise or signals-not-of-interest from interfering with the frequency estimation of portion of the signal of interest.

In your case, you can try high-quality resampling your data to double the sample rate to extract instantaneous frequency estimates from 50 to 100 Hz. Triple for 75 to 150, etc., assuming the sample rate and anti-aliasing mechanism captured spectrum in those ranges.


Given an analytic signal representation, Instantaneous frequency is well defined as the time derivative of phase:

$$f(t)= \frac{d \phi(t)}{dt}$$

With angle $\phi(t)$ in radians and time $t$ in seconds, this results in the instantaneous frequency in units of radians/sec. Divide that by $2\pi$ to get frequency in units of Hz.

Note that there are no other conditions on the frequency content of the waveform other than it being able to be represented in its analytic form showing it’s instantaneous amplitude and phase:

$$x(t)= A(t)e^{j\phi(t)}$$

We can have multi-tone signals as well as wideband signals that can still be represented as frequency modulated (and amplitude modulated) signals.

Below is a practical demonstration showing a multi-tone case with the resulting instantaneous frequency. The signal is composed of three discrete frequencies as a complex analytic signal as follows:

$$x(t) = e^{j2\pi 250 t} + 0.1 j e^{j2\pi 150 t} + 0.1 j e^{j2\pi 350 t} $$

The signal consists of three discrete tones at 150 Hz, 250 Hz, and 350 Hz, sampled at 1001 Hz. I also quantized these to 8 bits to create a more realistic (off the chalkboard) example showing use with a realistic waveform by including noise. I chose these specifically to create approximately the same result (with small angle approximations) as a sinusoidal frequency modulation of a single 250 Hz carrier at at 100 Hz rate. (I could have chosen any other arbitrary combination of signals which would result in both instantaneous amplitude and frequency where we could as well explore what the instantaneous frequency variation is alone using this process). If we process this signal that was indeed created from three discrete frequency tones, using the formula given for instantaneous frequency we get the result shown in the right plot below, together with the spectrum of $x(t)$ on the left. This is an example of a waveform that consists of multiple frequency components and is spread across a relatively large bandwidth, and the instantaneous frequency in this case is of useful interest.

spectrum and instantaneous frequency

  • $\begingroup$ (cont'd) your answer does more than state the definition of frequency. "there are no other conditions ... than being [representable] in analytic form", then also "can have multi-tone signals [that we can represent as above]", which runs into concerns I raised. I'm also not sure how it's a "condition" as any real-valued signal has an analytic representation. $\endgroup$ Commented Aug 13, 2022 at 15:23
  • $\begingroup$ @OverLordGoldDragon I did not precondition it to real values signals only. $\endgroup$ Commented Aug 13, 2022 at 17:34
  • $\begingroup$ Well, my points stand. When is such $f(t)$ (rather, $\phi(t)$) useful for multi-component, beyond a few trivial cases? If you're not claiming it's useful, it rather defeats the purpose of $f(t)$. $\endgroup$ Commented Aug 13, 2022 at 21:24
  • $\begingroup$ You are debating things I didn’t say, so I guess I don’t yet see your point. Do you think anything I said is incorrect? $\endgroup$ Commented Aug 13, 2022 at 23:10
  • $\begingroup$ You claim, here and under NinjaDarth, that we don't need to separate components, and only the analytic representation is required. I say this yields a useless $f(t)$ from a useless $\phi(t)$. Your answer, as written, is advocating for these useless quantities. $\endgroup$ Commented Aug 14, 2022 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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