Obtaining the envelope of AM signal using hilbert transform

39 visualizzazioni (ultimi 30 giorni)
Hi,
I have an amplitude modulated signal and want to extract the envelope
I tried using the hilbert transform and use the absolute value to obtain the amplitude.
The figure shows the original signal (wich is also the real part of the hilbert function) in red the imaginary part in blue and the envelope. I obtain the envelope as
abs(hilbert(signal)))
As you can see the envelope is not smooth and shows part of the carrier signal.
I'm wondering how to obtain a better estimate of the amplitude (and phase) of the signal.
Thanks!

Risposte (2)

David Goodmanson
David Goodmanson il 26 Mar 2021
Modificato: David Goodmanson il 26 Mar 2021
Hi Bernardo,
I don't think there is much doubt that the effect is due to a DC offset in the signal. In your figure, both the real and imaginary parts are shifted upward slightly as shown by the position of the positive and negative peaks. This code
x = (0:9999)/10000;
offset = .04;
y = cos(2*pi*10*x) + offset;
figure(1)
plot(x,y); grid on
h = hilbert(y) + i*offset; % imaginary offset post hilbert
figure(2)
plot(x,real(h),x,imag(h),x,abs(h)); grid on
shows the effect, with real in blue and imaginary in red. Setting offset = 0 gives a flat line for the envelope as expected.
The problem is, it is easy enough to presume an offset in the original real signal. But for hilbert, the imaginary part of the analytic signal has no DC offset. In order to reproduce your plot I had to apply a DC offset to the imaginary part after using hilbert.
  2 Commenti
Paul Hoffrichter
Paul Hoffrichter il 26 Mar 2021
So, to fix the problem, just remove the DC component from the signal. (If the DC component changes from one section of the signal to another, then adjust accordingly.)
% remove the DC component from y
ym = y - mean(y);
hm = hilbert(ym);
hmabs = abs(hm);
figure(4)
plot(x,real(hm),x,imag(hm),x,hmabs); grid on; title('abs(hm) with DC removed from signal')
Bernardo Pinto
Bernardo Pinto il 26 Mar 2021
The DC problem seems to be the case.
I think I need to do the average over a integer number of cycles in order for the mean to reflect the DC bias. Will substracting the mean fix the problem if you have a non integer number of cycles?
Greetings Bernardo

Accedi per commentare.


Paul Hoffrichter
Paul Hoffrichter il 26 Mar 2021
In general, if you increase the carrier frequency, you will get a better envelope.
Specific to your figure, to remove the ripple, you can take the FFT of your resultant envelope signal in the middle region avoiding the AM amplitude shift from low to high and high to low (which will show up in the fft as the highest frequencies). Between the DC and the highest frequencies should be a fairly distince ripple frequency. You can now apply a notch filter to remove the ripple.

Community Treasure Hunt

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

Start Hunting!

Translated by