HILBERT2 Extract instantaneous envelope and frequency from a bandlimited signal via Hilbert transform.
[ENV FREQ] = HILBERT2(X,FS), for vectors X, returns estimates of the instantaneous envelope and frequency. X is assumed to be a band-limited signal sampled at a rate specified by FS (in units of Hz). If FS is not specified, HILBERT2 uses a sampling rate of 1 Hz.
If X is a matrix, HILBERT2 operates along the columns of X.
If the input X is complex, then only the real part is used: X=real(X)
HILBERT2 returns the magnitude (ENV) and rate of change of the argument (FREQ) of the complex analytic signal corresponding to X. For a theoretical explication of this techinque and the formulas employed here, see:
Ktonas & Papp (1980) Instantaneous envelope and phase extraction from real signals. Signal Processing 2:373-385.
Be sure to visualize your results, as this technique may produce distortions when estimating the instantaneous envelope and frequency at the edges of the waveform.
Fs = 500; T = 10; N = Fs*T;
t = linspace(0,T,N)';
g = 2*pi*3*t + 75*normcdf(t,5,1);
A = 5 - 15*normpdf(t,5,1.5);
x = A.*cos(g);
%Extract instantaneous envelope and frequency
[env freq] = hilbert2(x,Fs);
figure(1); clf; subplot(2,1,1)
plot(t,x,'LineWidth',2); hold on
plot(t,[env -env],'LineWidth',2,'Color',[0 1 0.5])
xlim([1 9]); ylabel('Signal amplitude')
title('Original signal with instantaneous envelope')
axis([1 9 0 10]); xlabel('Time (sec)'); ylabel('Hz')
Created by Scott McKinney, October 2010
See also HILBERT
Scott McKinney (2023). hilbert2 (https://www.mathworks.com/matlabcentral/fileexchange/29072-hilbert2), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!