DSB AM Modulation in Matlab using Built-In functions

In the previous tutorial we showed how to generate DSB-SC AM signals using matlab code that did not use any built-in functions. Here we show an alternative method to generate AM signal using built-in function ammod() to generate DSB-AM(Double Sideband AM) signal.

AM (Amplitude Modulation) is a type of modulation in which the amplitude of a carrier signal is varied in proportion to the message signal being transmitted. The main types of AM are DSB-SC AM, SSB-SC AM and standard AM.

DSB-SC AM (Double Sideband Suppressed Carrier AM)

In this type of AM(Amplitude Modulation), the carrier signal is modulated by the message signal and two sidebands are generated with equal amplitude. The carrier signal is suppressed, leaving only the two sidebands. The equation for DSB-AM is:

y = ammod(x,fc,fs,'dsb');

where x is the message signal, fc is the carrier frequency, fs is the sampling frequency, and 'dsb' indicates the use of double sideband AM.

DSB-SC AM signal can be generated using diode such as single balanced diode mixer or using transistor such as using emitter modulation technique or using dedicated modulator IC such as MC1496 AM modulator.

Matlab Code

The following is matlab code to generate DSB-SC AM signal using the ammod() function and plot the signal waveform.

% AM modulation parameters
Ac=input('enter carrier signal amplitude: ');
Am=input('enter message signal amplitude: ');   % Am<Ac
fc=input('enter carrier frequency: ');
fm=input('enter message frequency: ');  % fm<fc

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

% Generate message signal
t = (0:ts:100*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
s = ammod(m,fc,fs);

% Plot the signals
title('Message signal');
xlabel('Time (s)');

title('Carrier signal');
xlabel('Time (s)');

title('DSB-AM signal');
xlabel('Time (s)');

xlabel('Time (s)');

This Matlab code generates a DSB-AM (double-sideband amplitude modulation) signal using the built-in function ammod().

The code first prompts the user to input the following parameters:

  • Carrier signal amplitude (Ac)
  • Message signal amplitude (Am)
  • Carrier frequency (fc)
  • Message frequency (fm)

This is as shown below.

matlab prompt

 The code then calculates the sampling frequency (fs) as twice the carrier frequency (2*fc) and the sampling time (ts) as the inverse of the sampling frequency (1/fs).

Next, the code generates the message signal (m) using the message signal amplitude (Am), the message frequency (fm), and the time vector (t). The time vector (t) is created using the sampling time (ts) and ranges from 0 to 100 times the sampling time.

The code generates the carrier signal (c) using the carrier signal amplitude (Ac), the carrier frequency (fc), and the time vector (t).

The code performs AM modulation using the built-in function ammod(), which takes the following arguments:

  • The message signal (m)
  • The carrier frequency (fc)
  • The sampling frequency (fs)

The result of the AM modulation is stored in the variable s.

Finally, the code plots the message signal, carrier signal, and DSB-AM signal in separate subplots. This is shown below.

DSB-AM signal waveform matlab

The ammod() function applies the modulation by multiplying the message signal with the carrier signal and adding it to the carrier signal. The ammod() function performs the modulation more efficiently than using the element-wise multiplication operator in the previous example, especially when dealing with larger signals.


[1] am modulation circuit diagram

Post a Comment

Previous Post Next Post