# Hilbert Huang Transform: Negative value in instantaneous frequency

I'm working on Hilbert Huang Tranform and have a question on computation of instantaneous frequency. I'm using HHT toolbox by Patrick Flandrin for EMD and computing IF manually. Problem is that I am getting negative values in IF.

Signal used: a $10\textrm{ Hz}$ sinusoid

 Ts=1/Fs;
t=0:Ts:4;
z= 5.*sin(2*10*pi*t);


Since this is a monocomponent frequency, IMF is the signal itself. I compute analytic signal using MATLAB function hilbert and then apply the following code to compute IF:

function [f] = inst_freq_manual(analytic_signal,Fs)

factor =  Fs/(2*pi);
N= length(analytic_signal);

% Differentiation formula
fin = factor*(angle(analytic_signal(2:N).*conj(analytic_signal(1:N-1))));

% Insert leading 0 in return-vector to maintain size
f = [0 fin];
end


I find that the IF values are negative. Mean of IF values =-9.9975 (correct numerical value but negative sign).

Plot of instantaneous parameters:

As per literature, the IMFs from HHT should have positive instantaneous frequencies.

• Can anyone please tell me where I am going wrong?
• Is using absolute value an option?
• Welcome to SE.DSP! Interesting question! Have you compared the way you're calculating the instantaneous frequency with the way Matlab suggests ? I'm wondering if there will be a difference. – Peter K. Jul 12 '17 at 18:03
• is the analytic signal computed correctly (can you show that code)? maybe you have $$x[n] - j \hat{x}[n]$$ instead of $$x[n] + j \hat{x}[n]$$. – robert bristow-johnson Jul 12 '17 at 18:48
• @robertbristow-johnson : They're using Matlab's hilbert function, but it's not clear to me what that will produce. – Peter K. Jul 12 '17 at 21:10
• well @PeterK., it would be useful to see both waveforms, side-by-side. because the difference equation (fin=) that the OP is using looks correct. – robert bristow-johnson Jul 12 '17 at 21:24
• Matlab recommends to calculate instant. freq. using phase accumulation and in the question here a different method was used which I believe is called homodyne discrimination. I can confirm that I'm having the same problem in Python: homodyne discrimination produces negative values of instant. freq., however phase accumulation (also recommended by SciPy docs) produces positive values. That of course when dealing with IMF-grade analytic signals as required by EMD. I hope someone eventually answers this question thoroughly... – mac13k Jan 16 '18 at 15:51