Demodulation of Standard AM with Hilbert Transform in Matlab

Standard AM signal also called conventional AM signal carries message signal or information signal in a carrier signal. There are three types of AM modulation: DSB-SC AM, standard AM and SSB-SC AM signal. The difference between them lies in what frequency part of the signal is sent. In standard AM, the full signal frequency of the modulated signal is transmitted. That is the carrier signal frequency, upper and lower signal frequency are transmitted. If the message bandwidth is W then the transmission bandwidth of standard AM is twice the message bandwidth, that is, 2W. In case of DSB-SC AM, both the upper and lower sideband are transmitted but the carrier signal is suppressed, that is, carrier signal is not transmitted. However the transmission bandwidth is equal 2W just as in standard AM. In SSB-SC AM, only either upper or lower sideband is transmitted and the transmission bandwidth is just W. 

In the earlier blog post Standard AM signal generation in Matlab it was shown how to generate standard AM signal and in the blog post Generate DSB-AM Signal in Matlab it was show how to generate DSB-SC AM signal in Matlab. Similarly in the tutorial post SSB-SC AM signal generation in Matlab it was shown how to generate SSB-SC AM signal. Here it is shown how to demodulate standard AM signal with Hilbert transform method.

There are two methods of demodulation of standard AM signal- one is the square law demodulation and the other is Hilbert transform demodulation. In square law demodulation method, the AM signal is passed through a square law device such as a diode and the output of the diode is then low pass filtered. In the Hilbert transform demodulation method, the signal is first passed through a Hilbert transformer and then the output of the Hilbert transformer is then low pass filtered.

Here it is illustrated how to demodulate standard AM signal using Hilbert Transform  method. A Hilbert transformer is a filter that shifts all the phase of the input signal by 90 degree. That is why it is also called broadband 90 degree phase shifter.

The following shows DSB-SC demodulation with Hilbert Filter circuit diagram.

standard AM demodulation with Hilbert Filter circuit diagram
The Matlab code for demodulation of AM signal using the Hilbert filter transformer is below.

Ac=0.8;
Am=0.5;    
fc=1000;
fm=100;
ka=0.8; 

fs = 10*fc;      % sampling frequency
ts = 1/fs;     % sampling time

% Generate message signal
t = (0:ts:500*ts).';  % time vector
m = Am*cos(2*pi*fm*t); % message signal

% Generate carrier signal
c = Ac*cos(2*pi*fc*t); % carrier signal

% Perform DSB-SC AM modulation
stx = (1+ka*m).*c;

% Add channel noise
SNR = 30; % signal-to-noise ratio in dB
stx_noisy = awgn(stx, SNR, 'measured');

% Demodulate using envelope detection
envelope = abs(hilbert(stx_noisy));
m_demod = (envelope./Ac-1)/ka;

% Plot the signals
subplot(4,1,1); plot(t,m); title('Message signal');
xlabel('Time (s)'); ylabel('Amplitude');

subplot(4,1,2); plot(t,stx); title('Carrier signal');
xlabel('Time (s)'); ylabel('Amplitude');

subplot(4,1,3); plot(t,stx_noisy); title('Noisy Standard AM signal');
xlabel('Time (s)'); ylabel('Amplitude');

subplot(4,1,4); plot(t,m_demod); title('Demodulated Standard AM signal');
xlabel('Time (s)'); ylabel('Amplitude');

This code generates a standard amplitude modulation (AM) signal with a sinusoidal message signal and a sinusoidal carrier signal, adds noise to the AM signal, and then demodulates the noisy signal using envelope detection. Here's a breakdown of what each part of the code does:

  • Ac=0.8;, Am=0.5;, fc=1000;, fm=100;, ka=0.8;: These variables define the carrier amplitude, message amplitude, carrier frequency, message frequency, and modulation index, respectively.

  • fs = 10*fc;, ts = 1/fs;: These variables define the sampling frequency and sampling time, respectively.

  • t = (0:ts:500*ts).';, m = Am*cos(2*pi*fm*t);, c = Ac*cos(2*pi*fc*t);: These lines generate the time vector t, the message signal m, and the carrier signal c.

  • stx = (1+ka*m).*c;: This line performs standard AM modulation by multiplying the message signal by the carrier signal, adding 1 to the result, and then multiplying it by the carrier signal again. This produces an AM signal with double-sideband (DSB) and suppressed-carrier (SC) components.

  • SNR = 30;, stx_noisy = awgn(stx, SNR, 'measured');: These lines add white Gaussian noise to the AM signal with a specified signal-to-noise ratio (SNR) in dB using the awgn function. The resulting noisy signal is stored in stx_noisy.

  • envelope = abs(hilbert(stx_noisy));: This line uses the Hilbert transform to extract the envelope of the noisy signal. The abs function takes the absolute value of the complex analytic signal to get the envelope.

  • m_demod = (envelope./Ac-1)/ka;: This line performs envelope detection to demodulate the noisy AM signal. The envelope is divided by the carrier amplitude Ac, subtracted by 1 to remove the carrier component, and then divided by the modulation index ka to recover the original message signal. The resulting demodulated signal is stored in m_demod.

  • subplot and plot functions: These functions are used to plot the original message signal, carrier signal, noisy AM signal, and demodulated signal on a 4x1 subplot. Each subplot is labeled with its corresponding title, xlabel, and ylabel.

Overall, this code demonstrates how to generate and demodulate a standard AM signal using MATLAB.

The following shows the transmitted message, the standard AM signal, the noisy standard AM signal and recovered message signal.

demodulated standard AM signal with hilbert filter

References:

[1] diode modulator circuit

[2] single balanced diode mixer

[3] am modulation circuit diagram

Post a Comment

Previous Post Next Post