dmod
引自:
Digital passband modulator数字带通调制
Syntax语法
y = dmod(x,Fc,Fd,Fs,...);
y = dmod(x,Fc,Fd,Fs,,M);
y = dmod(x,Fc,Fd,Fs,,M,tone);
y = dmod(x,Fc,Fd,Fs,);
y = dmod(x,Fc,Fd,Fs,,M);
y = dmod(x,Fc,Fd,Fs,,M);
y = dmod(x,Fc,Fd,Fs,,inphase,quadr);
y = dmod(x,Fc,Fd,Fs,,numsig,amp,phs);
y = dmod(x,Fc,Fd,[Fs phase],...);
[y,t] = dmod(...);
'method/nomap''ask''fsk''msk''psk''qask''qask/arb''qask/cir'
Optional Inputs
Input
Default Value
tone
Fd
amp
[1:length(numsig)]
phs
numsig*0
Description
The function dmod performs digital passband modulation and some related tasks. The corresponding demodulation function is dmod supports.
Modulation Scheme
Fifth Input Argument
M-ary amplitude shift keying
'ask'
M-ary frequency shift keying
'fsk'
Minimum shift keying
'msk'
M-ary phase shift keying
'psk'
Quadrature amplitude shift keying
'qask', 'qask/cir', or 'qask/arb'
To Avoid the Mapping Process
Ordinarily, the dmod function first maps the digital message signal to an analog signal and then modulates the analog signal. The generic syntax
y = dmod(x,Fc,Fd,Fs,'method/nomap'...)
uses the nomap flag to tell dmod that the digital message has already been mapped to an analog signal x whose sampling rate is Fs. As a result, dmod skips its usual mapping step. You can use the method is one of the seven values listed in the table above and the other variables are as in the next section.
To Modulate a Digital Signal (General Information)
The generic syntax y = dmod(x,Fc,Fd,Fs,...) modulates the digital message signal that x represents. x is a matrix of nonnegative integers. If x is a vector of length n, then y is a vector of length n*Fs/Fd. Otherwise, if x is n-by-m, then y is (n*Fs/Fd)-by-m and each column of x is processed separately.
Fc is the carrier frequency in Hertz. 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. For best results, use values such that Fs > Fc > Fd. The initial phase of the carrier signal is zero.
The generic syntax y = dmod(x,Fc,Fd,[Fs phase],...) is the same, except that the fourth input argument is a two-element vector instead of a scalar. The first entry, Fs, is the sampling rate as described in the paragraph above. The second entry, phase, is the initial phase of the carrier signal, measured in radians.
To Modulate a Digital Signal (Specific Syntax Information)
y = dmod(x,Fc,Fd,Fs,'ask',M)performs M-ary amplitude shift keying modulation. Each entry of x must be in the range [0, M-1]. The maximum value of the modulated signal is 1.
y = dmod(x,Fc,Fd,Fs,'fsk',M,tone)performs M-ary frequency shift keying modulation. Each entry of x must be in the range [0, M-1]. The optional argument tone is the separation between successive frequencies in the modulated signal y. The default value of tone is Fd. The maximum value of y is 1.
y = dmod(x,Fc,Fd,Fs,'msk')performs minimum shift keying modulation. Each entry of x is either 0 or 1. The maximum value of y is 1.
y = dmod(x,Fc,Fd,Fs,'psk',M)performs M-ary phase shift keying modulation. Each entry of x must be in the range [0, M-1]. The maximum value of y is 1.
y = dmod(x,Fc,Fd,Fs,'qask',M)performs M-ary quadrature amplitude shift keying modulation with a square signal constellation. The table below shows the maximum value of y, for several small values of M.
M
Maximum Value of y
M
Maximum Value of y
2
1
32
5
4
1
64
7
8
3
128
11
16
3
256
15
Note To see how symbols are mapped to the constellation points, generate a square constellation plot using (M).
y = dmod(x,Fc,Fd,Fs,'qask/arb',inphase,quadr)performs quadrature amplitude shift keying modulation, with a signal constellation that you define using the vectors inphase and quadr. The constellation point for the kth message has in-phase component inphase(k+1) and quadrature component quadr(k+1).
y = dmod(x,Fc,Fd,Fs,'qask/cir',numsig,amp,phs)performs quadrature amplitude shift keying modulation with a circular signal constellation. 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 (numsig,amp,phs,'n').
[y,t] = dmod(...)returns the computation time in t. t is a vector whose length is the number of rows of y.
Examples
An example on the reference page for dmod. Also, the code below shows the waveforms used to communicate the digits 0 and 1 using 4-ASK modulation. Notice that the dmod command has two output arguments. The second output, t, is used to scale the horizontal axis in the plot.
Fc = 20; Fd = 10; Fs = 50;
M = 4; % Use 4-ASK modulation.
x = ones(Fd,1)*[0 1]; x=x(:);
% Modulate, keeping track of time.
[y,t] = dmod(x,Fc,Fd,Fs,'ask',M);
plot(t,y) % Plot signal versus time.