Communications Toolbox 
Map a digital signal to an analog signal
Syntax
modmap('method
',...); y = modmap(x,Fd,Fs,'
ask
'
,M); y = modmap(x,Fd,Fs,'
fsk
'
,M,tone); y = modmap(x,Fd,Fs,'
msk
'
); y = modmap(x,Fd,Fs,'
psk
'
,M); y = modmap(x,Fd,Fs,'
qask
'
,M); y = modmap(x,Fd,Fs,'
qask/arb
'
,inphase,quadr); y = modmap(x,Fd,Fs,'
qask/cir
'
,numsig,amp,phs);
Optional Inputs
Input 
Default Value 
tone 
Fd 
amp 
[1:length(numsig)] 
phs 
numsig*0 
Description
The digital modulation process consists of two steps: mapping the digital signal to an analog signal and modulating this analog signal. The function modmap
performs the first step. You can perform the second step using amod
, amodce
, or your own custom modulator. The table below lists the digital modulation schemes that modmap
supports.
To Plot a Signal Constellation
modmap('
creates a plot that characterizes the method
',...)
M
ary modulation method that 'method'
specifies. 'method'
is one of the entries in the righthand column of the table above. If 'method'
is a value other than 'fsk
' or 'msk
', then the plot shows the signal constellation; otherwise, it shows the spectrum.
For most methods, the input parameters that follow 'method'
in this syntax are the same as those that follow 'method'
in the corresponding mapping syntax. For more information about them, see the section To Map a Digital Signal (Specific Syntax Information) below.
However, if 'method'
is 'msk
', then the syntax is
modmap('
msk
'
,Fd)
where Fd
is the sampling rate of the message signal.
To Map a Digital Signal (General Information)
The generic syntax y = modmap(x,Fd,Fs,...)
maps the digital message signal x
onto an analog signal. x
is a matrix of nonnegative integers. The sizes of x and y depend on the modulation method:
x
is a vector of length n, then y
is a column vector of length n*Fs/Fd
. Otherwise, if x
is nbym, then y
is (n*Fs/Fd
)bym and each column of x
is processed separately.x
is a vector of length n, then y
is an n*Fs/Fd
by2 matrix. Otherwise, if x
is nbym, then y
is (n*Fs/Fd
)by2m and each column of x
is processed separately. The oddnumbered columns in y
represent inphase components and the evennumbered columns represent quadrature components.The sampling rates in Hertz of x
and y
, respectively, are Fd
and Fs
. (Thus 1/Fd
represents the time interval between two consecutive samples in x
, and similarly for y
.) The ratio Fs/Fd
must be a positive integer.
To Map a Digital Signal (Specific Syntax Information)
y = modmap(x,Fd,Fs,
maps to an '
ask
'
,M)
M
ary amplitude shift keying signal constellation. Each entry of x
must be in the range [0, M
1]. Each entry of y
is in the range [1, 1].
y = modmap(x,Fd,Fs,
maps to frequencies in an '
fsk
'
,M,tone)
M
ary frequency shift keying set. Each entry of x
must be in the range [0, M
1]. The optional argument tone
is the separation between successive frequencies in the FSK set. The default value of tone
is Fd
.
y = modmap(x,Fd,Fs,
maps to frequencies in a minimum shift keying set. Each entry of '
msk
'
)
x
is either 0 or 1. The separation between the two frequencies is Fd/2
.
y = modmap(x,Fd,Fs,
maps to an '
psk
'
,M)
M
ary phase shift keying signal constellation. Each entry of x
must be in the range [0, M
1].
y = modmap(x,Fd,Fs,
maps to an '
qask
'
,M)
M
ary quadrature amplitude shift keying square signal constellation. The table below shows the maximum value of the inphase and quadrature components in y
, for several small values of M
.
M 
Maximum of y 
M 
Maximum of y 
2 
1 
32 
5 
4 
1 
64 
7 
8 
3 (quadrature maximum is 1) 
128 
11 
16 
3 
256 
15 
Note
To see how symbols are mapped to the constellation points, generate a square constellation plot using qaskenco (M) or modmap('qask',M) .

y = modmap(x,Fd,Fs,
maps to a quadrature amplitude shift keying signal constellation that you define using the vectors '
qask/arb
'
,inphase,quadr)
inphase
and quadr
. The signal constellation point for the kth message has inphase component inphase
(k+1) and quadrature component quadr
(k+1).
y = modmap(x,Fd,Fs,
maps to a quadrature amplitude shift keying circular signal constellation. '
qask/cir
'
,numsig,amp,phs)
numsig
, amp
, and phs
are vectors of the same length. The entries in numsig
and amp
must be positive. If k is an integer in the range [1, length(numsig)
], then amp
(k) is the radius of the kth circle, numsig
(k) is the number of constellation points on the kth circle, and phs
(k) is the phase of the first constellation point plotted on the kth circle. All points on the kth circle are evenly spaced. If you omit phs
, then its default value is numsig*0
. If you omit amp
, then its default value is [1:length(numsig)]
.
Note
To see how symbols are mapped to the constellation points, generate a labeled circle constellation plot using apkconst (numsig,amp,phs,'n') .

Examples
The command below plots a phase shift keying (PSK) signal constellation with 32 points.
modmap('psk',32);
The script below maps a digital signal using the 32point PSK constellation. It then adds noise and computes the resulting error rate while demapping. Your results might vary because the example uses random numbers.
M = 32; Fd = 1; Fs = 3; x = randint(100,1,M); % Original signal y = modmap(x,Fd,Fs,'psk',M); % Mapped signal, using 32ary PSK ynoisy = y+.1*rand(100*Fs,2); % Mapped signal with noise added z = demodmap(ynoisy,Fd,Fs,'psk',M); % Demapped noisy signal s = symerr(x,z) % Number of errors after demapping noisy signal s = 8
See Also
demodmap
, dmod
, dmodce
, amod
, amodce
, apkconst
marcumq  oct2dec 