Hilbert transform for instantaneous phase when time data does not begin at zero

20 views (last 30 days)
I have a simple cosine function and would like to extract the instantaneous phase. I am taking a Hilbert transform and computing the unwrapped angle of the analytic function. When my independent data begins at zero, the instantaneous phase matches the true phase. Unfortunately, my independent series cannot begin at zero for my experiment as it is a spatial frequency. When I compute the instantaneous phase from data where the series begins elsewhere, the phase profile is correct, but there is a DC shift in the phase.
How can I correct for this error due to my start position? Thanks!
clc; clear; close;
N = 10000;
t = linspace(0, 100, N);
f = 100;
phase = 2*t*f;
y = cos(phase);
Hy = hilbert(y);
Hphase = unwrap(angle(Hy));
plot(t, phase, t, Hphase, 'o')
  1 Comment
Philippe Strauss
Philippe Strauss on 12 Nov 2022
Foremost, beware that those hilbert functions in matlab and python's scipy are true / accurate on periodic / cyclic definitions of your input signal, in other words it will gives you gibb's phenomenon on non carefully windowed signals.
I'm willing to help you, but my matlab broke the other day, could you translate your matlab code to python numpy/scipy please?

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!