| Prev | Next | quadmod |
| Syntax |
y = quadmod(a,b,fc,pc,fs) |
| Include: |
include spt\quadmod.oms |
| See Also | ammod , fmmod , pmmod |
ARGUMENTS:
INPUTS:
a = MATRIX, any numerical type, coerced to DOUBLE for
internal processing. Represents sampled version of an
arbitrary baseband modulation waveform in [Volt].
b = MATRIX, any numerical type, coerced to DOUBLE for
internal processing. Represents sampled version of an
arbitrary baseband modulation waveform in [Volt].
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 QUADRATURE MODULATION
waveform. Same dimensions as input 'm'.
Sample a QUADRATURE MODULATION modulated carrier
with given baseband modulation waveform, carrier frequency and
carrier phase in a column-wise fashion.
Returns a sampled version of a QUADRATURE MODULATION modulated
carrier with the same dimensions as inputs 'a' and 'b'. 'a' and
'b' matrices must have identical dimensions. The user specifies
the arbitrary baseband modulation waveforms 'a' and 'b'
in [Volt], the sampling rate 'fs' in [Samples/sec], the carrier
frequency in [Hz], and the carrier initial phase angle in [radians],
All inputs may be any numerical type and are coerced to DOUBLE for
local processing.
The general form of the modeled FM waveform is:
a%cos(2*PI*fc*t + pc) + b%sin(2*PI*fc*t + pc),
and this waveform is sampled at a rate of 'fs'. Waveform 'a' is
referred to as the 'in-phase' component and waveform 'b' is referred
to as the 'quadrature' component of the resulting waveform. This
is the most general form of a modulated carrier and is often used
in communication system modeling. By proper choice of baseband
waveforms 'a' and 'b' a variety of modulated waveforms may be
created: CW, AM, PM, FM, DSB-supressed carrier, etc.
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 'a', 'b' or 'fc' higher than half the
sampling rate without error. (This is in fact done deliberately in
some sampled data systems).
# Create a QUADRATURE modulated waveform
# Different frequencies in I and Q components
fs = 256d0; # sampling rate [Samples/second]
N = 256; # record length [Samples]
fc = 32d0; # carrier frequency [Hz]
pc = 1d0; # initial carrier phase [radians]
fmI = 5d0; # modulation freq [Hz]
fmQ = 2d0; # modulation freq [Hz]
twopit = 2d0*PI*(seq(N)-1d0)/fs; # Create 2*PI*time
a = cos(twopit*fmI); # For In-Phase Component
b = sin(twopit*fmQ); # For Quadrature Component
quad = quadmod(a,b,fc,pc,fs); # time waveform
spec = abs(dft(complex(quad))/N)^2d0; # spectrum power
quadspec = spec.row(1,N/2+1);
quadspec = quadspec + {0d0,reverse(spec.row(N/2+1,N/2))};
quadspec = db10(quadspec); # 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("QUADRATURE MODULATOR Function", [.5,.95]);
s=["fs =",ntoa(fs)," Hz"," , fc =",ntoa(int(fc))," Hz, ","fmI=",ntoa(int(fmI))," fmQ=",ntoa(int(fmQ))," 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,quad);
gxtitle("TIME [SEC]");
gytitle("VOLTS");
gtitle("quadmod() 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 [Hz]");
gytitle("MAG [dB]");
gtitle("quadmod() SPECTRUM");
gplot(f.row(1,N/2+1),quadspec);