My understanding if a frequency in my signal doesn't line up exactly with a bin, it is smeared over a few bins to the right and left.

How can the instantaneous magnitude be determined? (do I have to worry about the windowing function?)


3 Answers 3


Frist of all you need compute the Magnitude:

windowed = framed .* hann(length(framed))
Fourier = fft(windowed)
Mag = abs(Fourier)

And you need build a Window Kernel based in your Window Function!

For a Hann Window the kernel can be:

   Wk(k) = 0.5 * (sinc(k*(M/N)) / (1 - (k*(M/N))^2))

M=Window Size 
N=FFT Size

Of course you can use the same size for both, N and M !

k = Bin Number from FFT / N
sinc = Normalized Sinc, visit http://en.wikipedia.org/wiki/Sinc_function

If you have already determined the Instantaneous Frequency, you need find the corresponding offsets for each Frequency and the Instantaneous Magnitude is found when you multiply the magnitude from FFT by your Hann Window Kernel index:

 Offset = abs(InstFreqs(i) / (Fs/N) - i)
 index = floor(abs(Offset) * N) + 1
 InstMag = Mag(i) * Wk(index)

Instantaneous frequency is given by the derivative of the phase of the analytic signal. The analytic signal is

$$ f_A(x) = f(x) + \mathrm{i} (h \ast f)(x)$$

where $h(x)$ is the Hilbert transform kernel. It can be written as

$$ f_A(x) = A(x) e^{\mathrm{i} \phi(x)}$$

where $A(x) = |f_A(x)|$ and $\phi(x) = \arg(f_A(x))$. $A(x)$ is called the instantaneous amplitude and $\phi(x)$ is called the instantaneous phase. Instantaneous frequency in radians is then given by

$$\omega(x) = \frac{d}{dx} \phi(x)$$

The Hilbert transform has an infinite impulse response and therefore uses the entire signal to compute. Typically one would bandpass the signal to localise the response. This both smears the signal in the spatial domain and removes DC and high frequency components. The values calculated as above are then called local amplitude, phase and frequency. Since the Hilbert transform has a discontinuity at DC in the Fourier domain, it is good to remove this first.

In MATLAB to get analytic signal it is

f_A = hilbert(f);
A = abs(f_A);
phase = angle(f_A);

But now the tricky bit, how to differentiate the phase? This is discussed here:


I would try taking a section of the phase signal centred at the point of interest, fit a polynomial, then calculate the derivative from the polynomial coefficients.


are you doing this for a phase vocoder or something? are you doing the short-time fourier transform (STFT) with multiple frames?

i have trouble connecting "instantaneous frequency" (which you get from computing the analytical signal) to "bins" from an FFT output. you can calculate stuff like group delay, but to get a changing frequency, you need to have multiple frames (spaced in time) and look at the change of phase (at a variety of bins) from one frame to the next.

  • $\begingroup$ RBJ good to see you here, and you are right about the use of Intantaneous Magnitude for a phase vocoder, some time ago I try use it together with a phase vocoder, and is hard connect IF correctly ... $\endgroup$
    – ederwander
    Dec 14, 2013 at 19:58
  • $\begingroup$ Yes sorry. I'm using the Phase Vocoder (Flanagan) to get the Instantaneous Frequency. I just wasn't sure what the best way to determine this frequencies amplitude (I called it instantaneous magnitude). $\endgroup$ Dec 15, 2013 at 5:20

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.