-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHilbert_Phase.m
More file actions
25 lines (22 loc) · 1.08 KB
/
Hilbert_Phase.m
File metadata and controls
25 lines (22 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
% This function computes the hilbert transform based phase known as
% hilbert phase for a given discrete time signal and computes the complex
% valued analytic signal and extracts the argument of the complex time
% series and limits the value to fundamental interval of 0 to 2*pi.
% =========================================================================
% Input
% =========================================================================
% Discrete time series LFP data
% =========================================================================
% Output
% =========================================================================
% Instantaneous hilbert phase as a time series
% =========================================================================
function result = Hilbert_Phase(input)
data = double(input);
%Perform hilbert transform on input data
tdata = hilbert(data);
%Obtain hilbert phase in radians the values ranges from -pi to +pi
output = atan2(imag(tdata),real(tdata));
% The phase will now range from 0 to 2 pi radians
result = mod(output,2*pi);
end