Communications Toolbox | ![]() ![]() |
Syntax
y = amod(x,Fc,Fs,'
amdsb-tc
'
,offset); y = amod(x,Fc,Fs,'
amdsb-sc
'
); y = amod(x,Fc,Fs,'
amssb/
opt
'
); y = amod(x,Fc,Fs,'
amssb/
opt
'
,num,den); y = amod(x,Fc,Fs,'
amssb/
opt
'
,hilbertflag); y = amod(x,Fc,Fs,'
qam
'
); y = amod(x,Fc,Fs,'
fm
'
,deviation); y = amod(x,Fc,Fs,'
pm
'
,deviation); y = amod(x,Fc,[Fs initphase],...); [y,t] = amod(...);
Optional Inputs
Input |
Default Value, or Default Behavior If Input Is Omitted |
offset |
-min(min(x)) |
|
Omitting this argument causes amod to produce the lower sideband instead of the upper sideband. |
deviation |
1 |
Description
The function amod
performs analog passband modulation. The corresponding demodulation function is ademod
. The table below lists the modulation schemes that amod
supports.
For All Syntaxes
The generic syntax y = amod(x,Fc,Fs,...)
modulates the message signal that x
represents. Fc
is the carrier frequency in hertz, and Fs
is the sampling rate in hertz. (Thus 1/Fs
represents the time interval between two consecutive samples in x
.) The initial phase of the carrier signal is zero. By the Nyquist theorem, the sampling rate must be at least twice as large as the modulation carrier frequency. x
and y
are real matrices whose sizes depend on the demodulation method:
x
must have an even number of columns. The odd-numbered columns in x
represent in-phase components and the even-numbered columns represent quadrature components. If x
is n-by-2m, then y
is n-by-m and each pair of columns of x
is processed separately.
x
and y
have the same dimensions. If x
is a two-dimensional matrix, then each column of x
is processed separately.
The generic syntax y = amod(x,Fc,[Fs initphase],...)
is the same, except that the third 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, initphase
, is the initial phase of the carrier signal, measured in radians.
For Specific Syntaxes
y = amod(x,Fc,Fs,
implements double-sideband amplitude modulation. '
amdsb-tc
'
,offset)
offset
is the value added to x
prior to the modulation. If you omit offset
, then its default value is -min(min(x))
. This default value produces 100% modulation.
y = amod(x,Fc,Fs,
implements double-sideband suppressed-carrier amplitude modulation.'
amdsb-sc
'
)
y = amod(x,Fc,Fs,
implements single-sideband suppressed-carrier amplitude modulation. By default, it produces the lower sideband; if '
amssb/
opt
'
)
opt
is up
, then the function produces the upper sideband. This syntax does a Hilbert transform in the frequency domain.
y = amod(x,Fc,Fs,
is the same as the syntax above, except that it specifies a time-domain Hilbert filter. '
amssb/
opt
'
,num,den)
num
and den
are row vectors that give the coefficients, in descending order, of the numerator and denominator of the filter's transfer function. You can use the function hilbiir
to design the Hilbert filter.
y = amod(x,Fc,Fs,
is the same as the syntax above, except that it uses a default time-domain Hilbert filter. The filter's transfer function is defined by '
amssb/
opt
'
,hilbertflag)
[num,den] = hilbiir(1/Fs)
, where num
and den
are as in the paragraph above. The input argument hilbertflag
can have any value.
y = amod(x,Fc,Fs,
implements quadrature amplitude modulation. '
qam
'
)
x
is a two-column matrix whose first column represents the in-phase signal and whose second column represents the quadrature signal. y
is a column vector.
y = amod(x,Fc,Fs,
implements frequency modulation. The spectrum of the modulated signal is between '
fm
'
,deviation)
min(x) + Fc
and max(x) + Fc
. The optional argument deviation
is a scalar that represents the frequency deviation constant of the modulation. The command y = amod(x,Fc,Fs,'
fm
',deviation)
is equivalent to the command y = amod(x*deviation,Fc,Fs,'
fm
')
.
y = amod(x,Fc,Fs,
implements phase modulation. The optional argument '
pm
'
,deviation)
deviation
is a scalar that represents the phase deviation constant of the modulation. The command y = amod(x,Fc,Fs,'
pm
',deviation)
is equivalent to the command y = amod(x*deviation,Fc,Fs,'
pm
')
.
[y,t] = amod(...)
returns the computation time in t
.
Double- and Single-Sideband Comparison Example
The first example compares the spectra of signals after modulation using the double-sideband and single-sideband techniques. The message signal is a frequency-one sine wave and the carrier signal is a 10 Hz sine wave. The script below uses the '
amdsb-sc
'
and '
amssb
'
arguments in the amod
function to produce modulated signals ydouble
and ysingle
, respectively. It then plots the spectra of both modulated signals.
% Sample the signal 100 times per second, for 2 seconds. Fs = 100; t = [0:2*Fs+1]'/Fs; Fc = 10; % Carrier frequency x = sin(2*pi*t); % Sinusoidal signal % Modulate x using single- and double-sideband AM. ydouble = amod(x,Fc,Fs,'amdsb-sc'); ysingle = amod(x,Fc,Fs,'amssb'); % Plot spectra of both modulated signals. zdouble = fft(ydouble); zdouble = abs(zdouble(1:length(zdouble)/2+1)); frqdouble = [0:length(zdouble)-1]*Fs/length(zdouble)/2; plot(frqdouble,zdouble); % The plot on the left-hand side below figure; zsingle = fft(ysingle); zsingle = abs(zsingle(1:length(zsingle)/2+1)); frqsingle = [0:length(zsingle)-1]*Fs/length(zsingle)/2; plot(frqsingle,zsingle); % The plot on the right-hand side below
Notice that the spectrum in the left plot has two peaks; these are the lower and the upper sidebands of the modulated signal. The two sidebands are symmetrical with respect to the 10 Hz carrier frequency, Fc
. The spectrum of a DSB-SC AM modulated signal is twice as wide as the input signal bandwidth. In the right plot, there is one peak because the SSB AM technique requires amod
to transmit only one sideband.
Hilbert Filter Example
The next example uses a Hilbert filter in the time domain.
Fc = 25; % Carrier signal frequency Fs = 100; % Sampling rate of signal [numh,denh] = hilbiir(1/Fs,15/Fs,15); % Design Hilbert filter. t = [0:1/Fs:5]'; % Times to sample the signal x = cos(t); % Signal is a cosine wave. y = amod(x,Fc,[Fs pi/4],'amssb',numh,denh); % Modulate, % using a Hilbert filter in the time domain. z = ademod(y,Fc,[Fs pi/4],'amssb'); % Demodulate. plot(t,z) % Plot recovered signal.
The resulting plot is on the left below. If you replace the sixth line above with
then modulation uses a Hilbert transform in the frequency domain. The result is the plot on the right below. The two plots differ slightly in their initial errors.
See Also
ademod
, dmod
, ddemod
, amodce
, ademodce
![]() | ademodce | amodce | ![]() |