I'm using Octave and trying to use the "instfreq" function from the time frequency toolbox which requires an analytic signal input. To get this analytic signal I'm using the Octave function "hilbert" on my real valued signal thus:
analytic_sig = hilbert( my_real_valued_signal ) ;
[ instf, t ] = instfreq( analytic_signal ) ;
where instf is the instantaneous frequency I'm trying to obtain. However, the results are not quite what I expected. I suspect that the 90 degree phase shift induced by the hilbert transform is where the problem lies, so my question is how can I alter the output of the Octave "hilbert" function to compensate/adjust for this phase shift?
Edit in response to comments
With a simple test case I'm creating a signal x with instantaneous frequency ifl
octave:1> [x ifl] = fmlin(10,0.05,0.35)
x =
-0.97815 - 0.20791i
-0.80902 - 0.58779i
-0.30902 - 0.95106i
0.50000 - 0.86603i
1.00000 + 0.00000i
0.30902 + 0.95106i
-0.91355 + 0.40674i
-0.30902 - 0.95106i
1.00000 - 0.00000i
-0.50000 + 0.86603i
ifl =
0.050000
0.083333
0.116667
0.150000
0.183333
0.216667
0.250000
0.283333
0.316667
0.350000
but in my envisioned real life application I will only have data for the real component
octave:2> real_sig = real(x)
real_sig =
-0.97815
-0.80902
-0.30902
0.50000
1.00000
0.30902
-0.91355
-0.30902
1.00000
-0.50000
using the hilbert function I create an analytic signal from my available real data
octave:3> anal_sig = hilbert( real_sig )
anal_sig =
-0.97815 + 0.07265i
-0.80902 - 0.41187i
-0.30902 - 0.92331i
0.50000 - 0.81514i
1.00000 + 0.04490i
0.30902 + 0.98765i
-0.91355 + 0.52573i
-0.30902 - 0.89042i
1.00000 + 0.28002i
-0.50000 + 1.12978i
and when this is put in to the instfreq function I get the measured instantaneous frequency instf
octave:4> instf = instfreq( anal_sig )
instf =
0.10520
0.13131
0.15427
0.18209
0.20487
0.24755
0.31328
0.30974
The instfreq function returns values in the range [2:end-1] of its input, so padding to make an easy comparison
octave:5> [ ifl [ 0 ; instf ; 0 ] ]
ans =
0.05000 0.00000
0.08333 0.10520
0.11667 0.13131
0.15000 0.15427
0.18333 0.18209
0.21667 0.20487
0.25000 0.24755
0.28333 0.31328
0.31667 0.30974
0.35000 0.00000
it can be seen that the measured frequency is different from the true, known frequency. Thinking of a phasor diagram, I was thinking that perhaps some trigonometric manipulation of the real and imaginary components of the hilbert function output might correct this.