| Prev | Next | fmmod |
| Syntax |
y = fmmod(m,kf,fc,pc,fs) |
| Include: |
include spt\fmmod.oms |
| See Also | ammod , 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].
kf = SCALAR, any numerical type, coerced to DOUBLE for
internal processing. Modulator sensitivity in
[Hz/Volt]. Scales 'm' before modulation.
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 FM waveform. Same
dimensions as input 'm'.
Sample a FM (Phase Modulation) modulated carrier
with given baseband modulation waveform, carrier frequency
and carrier phase in a column-wise fashion.
Returns a sampled version of a FM modulated carrier with the
same dimensions as input 'm'. The user specifies the
arbitrary baseband modulation waveform 'm' in [Volt], the
sampling rate 'fs' in [Samples/sec], the carrier frequency in
[Hz], the carrier initial phase angle in [radians], and the
modulator sensitivity 'kf' in [Hz/Volt]. All inputs may be
any numerical type and are coerced to DOUBLE for local
processing.
The general form of the modeled FM waveform is:
cos(2*PI*fc*t + 2*PI*kf*(integral of m from 0 to t)+ pc,
and this waveform is sampled at a rate of 'fs'. The frequency
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 'kf' scales the waveform 'm'
before applying it to the carrier and converts the modulation
voltage to radians.
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).
Example
# Create a FM 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
kf = 1; # Hz/volt
df = 2.0*fm1; # peak freq deviation for freq mod[Hz]
fm = fmmod(df*m,kf,fc,pc,fs); # time waveform
spec = abs(dft(complex(fm))/N)^2d0; # spectrum power
fmspec = spec.row(1,N/2+1); # Form the spectrum for plotting
fmspec = fmspec + {0d0,reverse(spec.row(N/2+1,N/2))};
fmspec = db10(fmspec); # 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("FM 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,fm);
gxtitle("TIME");
gytitle("VOLTS");
gtitle("fmmod() WAVEFORM");
gygrid("minor");
gxgrid("major");
vp2 = gaddview(.05, .05, .90, .35 );
gyaxis("linear",-60,0,6,2);
gxaxis("linear",0,fs/2,4,4);
gygrid("minor");
gxgrid("major");
gxtitle("FREQ");
gytitle("MAG [dB]");
gtitle("fmmod() SPECTRUM");
gplot(f.row(1,N/2+1),fmspec);
REFERENCE
Haykin, Simon, "Communication Systems.", New York: Wiley, 1994.