MATLAB: Phase angle from discrte hilbert tranform

hilbert-transformMATLABsignal processing

If I have time series data and I want to Hilbert transformation it to get the phase angle as a function of time what do I need to do? Sorry I'm completely stumped and brand new to matlab

Best Answer

Hi Bobby, the derivative of the phase of the analytic signal is the instantaneous frequency that is true. But estimating the instantaneous frequency is tricky business. There are a number of papers on algorithms for that. It's very sensitive to noise for one thing. Yes, in the simple case I gave you, you can fit a least squares line to the unwrapped phase and get the frequency. But that is because the instantaneous frequency is the same everywhere.
x = cos(pi/4*(0:99));
y = hilbert(x);
sigphase = (unwrap(angle(y)))';
X = ones(length(sigphase),2);
X(:,2) = (1:length(sigphase))';
beta = X\sigphase;
beta(2)
Note beta(2) is very close to the frequency of pi/4. But this is a very simple example where the frequency is not changing.