## hilbert2

Version 1.0.0.0 (2.68 KB) by
Extract instantaneous envelope and frequency from a bandlimited signal via Hilbert transform.

Updated 18 Oct 2010

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.

EXAMPLE:

%Create signal
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);

%Plot results
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')
subplot(2,1,2); plot(t,freq,'k','LineWidth',2);
axis([1 9 0 10]); xlabel('Time (sec)'); ylabel('Hz')
title('Instantaneous frequency');

Created by Scott McKinney, October 2010
http://www.mathworks.com/matlabcentral/fileexchange/authors/110216

### Cite As

Scott McKinney (2023). hilbert2 (https://www.mathworks.com/matlabcentral/fileexchange/29072-hilbert2), MATLAB Central File Exchange. Retrieved .

##### MATLAB Release Compatibility
Created with R2009a
Compatible with any release
##### Platform Compatibility
Windows macOS Linux
##### Categories
Find more on Hilbert and Walsh-Hadamard Transforms in Help Center and MATLAB Answers