This example shows how to extract the signal envelope using the analytic signal.
Create a double sideband amplitude-modulated signal. The carrier frequency is 1 kHz. The modulation frequency is 50 Hz. The modulation depth is 100%. The sampling frequency is 10 kHz.
t = 0:1e-4:1; x = [1+cos(2*pi*50*t)].*cos(2*pi*1000*t); plot(t,x) xlim([0 0.1]) xlabel('Seconds')
Obtain the analytic signal. Extract the envelope, which is the magnitude (modulus) of the analytic signal. Plot the envelope along with the original signal.
y = hilbert(x); env = abs(y); plot(t,x) hold on plot(t,[-1;1]*abs(y),'r','LineWidth',2) xlim([0 0.1]) xlabel('Seconds')
The magnitude of the analytic signal captures the slowly varying features of the signal, while the phase contains the high-frequency information.