| Prev | Next | ammod |
| Syntax |
y = ammod(m,ka,fc,pc,fs) |
| Include: |
include spt\ammod.oms |
| See Also | fmmod , pmmod , quadmod |
ARGUMENTS:
INPUTS:
m = MATRIX, any numerical type, coerced to DOUBLE for
internal processing. Represents sampled version of an
arbitrary baseband modulation waveform in [Volt].
ka = SCALAR, any numerical type, coerced to DOUBLE for
internal processing. Modulator sensitivity in [1/Volt].
Scales 'm' before modulation. Typically 0.0 to 1.0.
fc = SCALAR, any numerical type, coerced to DOUBLE for
internal processing. Carrier frequency in [Hz].
pc = SCALAR, any numerical type, coerced to DOUBLE for
internal processing. Carrier phase in [radians].
fs = SCALAR, any numerical type, coerced to DOUBLE for
internal processing. Sampling rate in [Samples/sec].
RETURN: MATRIX, type DOUBLE, sampled AM waveform. Same
dimensions as input 'm'.
Sample a AM (Amplitude Modulation) modulated
carrier with given baseband modulation waveform, carrier
frequency and carrier phase in a column-wise fashion.
Returns a sampled version of a AM modulated carrier with the
same dimensions as input 'm'. The user specifies the
arbitrary baseband modulation waveform 'm' in [Volts],
the sampling rate 'fs' in [Samples/sec], the carrier frequency
in [Hz] 'fc', the carrier initial phase angle in [radians]
'pc', and the modulator sensitivity 'ka' in [1/Volt]. All
inputs may be any numerical type and are coerced to DOUBLE
for local processing.
The general form of the modeled AM waveform is:
(1 + ka*m) % cos(2*PI*fc*t + pc),
and this waveform is sampled at a rate of 'fs'. The amplitude of
the resulting carrier sinusoid is proportional waveform 'm'. 'm'
may be a matrix, in which case an identically dimensioned matrix
is returned where each column of 'm' has separately been modulated
onto the specified carrier. The modulation sensitivity factor 'ka'
scales the waveform 'm' before applying it to the carrier and
typically has a value of 0.0 to 1.0 (though not restricted by the
function). The user should note that if the quantity 'ka*m' is
anywhere less than -1 then the waveform is said to be
'overmodulated', i.e., carrier phase reversals occur. This
situation is allowed by the function and it is up to the user to
suitably restrict the waveform 'm' as desired.
It should also be noted that the function places no restrictions
on the relation between carrier, modulation, or sampling frequencies.
The user may 'under-sample' the waveform by making the maximum
frequency represented in 'm' or 'fc' higher than half the sampling
rate without error. (This is in fact done deliberately in some
sampled data systems).
# Create a 100% AM modulated waveform
fs = 256d0; # sampling rate [Samples/second]
N = 256; # record length [Samples]
fc = 32d0; # carrier frequency [Hz]
pc = 1d0; # initial carrier phase [radians]
fm1 = 4d0; # modulation freq [Hz]
twopit = 2d0*PI*(seq(N)-1d0)/fs; # Create 2*PI*time
m = cos(twopit*fm1); # Create modulation waveform
ka = 1; # Modulator Sensitivity, 1Volt/Volt
am = ammod(m,ka,fc,pc,fs); # Create the time waveform
spec = abs(dft(complex(am))/N)^2d0; # Compute the spectrum power
amspec = spec.row(1,N/2+1); # Select first half of the spectrum
amspec = amspec + {0d0,reverse(spec.row(N/2+1,N/2))};
amspec = db10(amspec); # spectrum mag, dB
t = timeaxis(1d0/fs, N); # time axis for plotting
f = freqaxis(fs/N, N); # freq axis for plotting
ginit;
format double "f7.1";
gaddtext("AM MODULATOR Function", [.5,.95]);
s=["fs =",ntoa(fs)," Hz"," , fc =",ntoa(int(fc))," Hz"," , fm =",ntoa(int(fm1))," Hz"];
gaddtext(s, [.5,.90]);
vp1 = gaddview(0.05, 0.50, .90, .35 );
gyaxis("linear",-2,2,2,2);
gxaxis("linear",0,N/fs,4,5);
gplot(t,am);
gxtitle("TIME");
gytitle("VOLTS");
gtitle("ammod() WAVEFORM");
gygrid("minor");
gxgrid("major");
vp2 = gaddview(.05, .05, .90, .35 );
gyaxis("linear",-20,0,4,2);
gxaxis("linear",0,fs/2,4,4);
gygrid("minor");
gxgrid("major");
gxtitle("FREQ");
gytitle("MAG [dB]");
gtitle("ammod() SPECTRUM");
gplot(f.row(1,N/2+1),amspec);
Reference
Haykin, Simon, "Communication Systems.", New York: Wiley, 1994 .