Modulation and Demodulation

This toolbox contains functions for analog and digital modulation and demodulation. You can use the toolbox to simulate a communication system using passband or baseband. There are six sublibraries included in the SIMULINK block library.
The Modulation and Demodulation Library includes the following sublibraries:
Passband Analog Modulation and Demodulation
Passband Digital Modulation and Demodulation
Passband Digital Modulation and Demodulation with a separated Map/Demap
Baseband Analog Modulation and Demodulation
Baseband Digital Modulation and Demodulation
Baseband Digital Modulation and Demodulation with a separated Map/Demap

You can view a list of all SIMULINK blocks in this category.

You can use either SIMULINK blocks or MATLAB functions for the simulation. The MATLAB functions for modulation and demodulation are as follows:

amod - Modulation computation.
ademod - Demodulation computation.
amodce - Complex envelope of analog modulation.
ademodce - Demodulate from a complex envelope of analog modulated signal.
dmodce - Complex envelope of digital modulation.
ddemodce - Demodulate from complex envelope of digital modulated signal.
modmap - Digital modulation mapping.
demodmap - Digital demodulation demapping.

There are some other supporting functions in this category:

apkconst - Compute/plot ASK/PSK constellation from NIR, AIR, PIR.
qaskenco - Encode a message to two-dimensional form for QASK use.
qaskdeco - Decode a two-dimensional code into a one dimension message.

The analog modulation part includes the methods:

AM DSB-SC Double sideband suppressed carrier amplitude modulation
AM SSB-SC Single sideband suppressed carrier amplitude modulation
AM DSB-TC Double sideband amplitude modulation with transmitting carrier
QAM Quadrature multiplex amplitude modulation
FM Frequency modulation
PM Phase modulation

The digital modulation part includes the methods:

AKS Amplitude shift keying modulation
QAKS Quadrature amplitude shift keying modulation
You can use one of the following three constellations:
Square constellation
Circle constellation
User defined arbitrary constellation
FSM frequency shift keying modulation
PSK phase shift keying modulation
MSK minimum shift keying modulation

The following examples use the parameters:
Simulation sample time: ts = 0.01;
Carrier frequency: Fc = 100/2/pi;
Low pass filter: [num, den] = butter(2, Fc*ts);
Simulation time vector: t = [0:ts:3];
Message signal: x = sin(t*pi);

Example 1: Passband AM SSB-SC simulation. This example uses the following MATLAB commands:

y1 = amod(x, Fc, 1/ts, 'amssb');
y2 = amod(x, Fc, 1/ts, 'amssb/upper');
z = amod(y1, Fc, 1/ts, 'amssb', num, den);
subplot(312);
plot(t, [x, z]);
subplot(313);
plot(t, y1);
y1 = fft(y1, 512);
y1 = y1 .* conj(y1) / 512;
y2 = fft(y2, 512);
y2 = y2 .* conj(y2) / 512;
% frequency scale.
f = 1000*(0:255)/512;
subplot(311);
plot(f, [y1 y2]);

Example 2: Passband QAM simulation. This example uses the following MATLAB commands:

x = [x sin(t*3*pi)];
y = amod(x, Fc, 1/ts, 'qam');
z = amod(y, Fc, 1/ts, 'qam', num, den);
subplot(211);
plot(t, [x, z]);
subplot(212);
plot(t, y);

Example 3: 64-QASK square constellation This example uses the following MATLAB command:

dmod('qask', 64);

Example 4: 128-QASK arbitrary constellation This example uses the following MATLAB commands:

x=modmap([0:127],1,1,'qask',128);
modmap('qask/arbitrary',x(:,1),x(:,2));

In this example, the first modmap generates a vector of the constellation from a square constellation. The second modmap generates the constellation plot.

Example 5: 16-QASK modulation.

This example uses the following MATLAB commands:

M=16;
N = 20;
Fs = 100;
x = randint(N, 1, M);
y = dmod(x, 10, 1, Fs, 'qask', M);
xx=modmap(x, 1, 1, 'qask', M);
[ny, my] = size(y);
y_n = y + (rand(ny, my) - .5) * 1.5;
z = ddemod(y_n, 10, 1, Fs, 'qask', M);
subplot(311)
plot([0:N-1],x(:),'o',[0:N-1],z(:),'*');
title('Digital signal. original: o, and recovered: *');
subplot(312)
plot([0:N-1],xx(:,1),'+',[0:N-1],xx(:,2),'x')
title('Mapped Signal. In-phase + and Quadrature x');
subplot(313)
plot([0:1/Fs:N-1/Fs],y);
title('Modulated signal');

In the figure generated from this example, the upper plot is a comparison between the original message from the transmitting side and the recovered message from the receiving side. The middle plot is the mapped signal in the digital modulation. The bottom plot is the modulated signal. You can view the 16-QASK square constellation used in this example by using the command:

dmod('qask', 16);

Return to the first page of the tutorial
Return to the functionality listing

This is hcommodu.html file.