EE-451 Lab #2 AM and FM Systems Using MATLAB: General
EE-451 Lab #2 AM and FM Systems Using MATLAB: General
Lab #2
AM and FM Systems Using MATLAB
General
The modulation and demodulation of a carrier signal will be performed in this lab (using
MATLAB). Spectral calculations will be made using the fft() function.
AM Spectra
φ(t ) = (1 + am (t )) cos ωc t.
where ω m is the audio (or modulating) frequency. Let fc=32, fm=3 and µ =0.5. (ω = 2π
f.) Create an array phi—following the procedure outlined in Lab #1—with 256 samples.
Plot the waveform.
Recompute phi and PHI with fm = 2 and a = 1.5. Plot both phi and PHI. For both values
of fm and a, explain the plots for phi and PHI (explain the frequencies and the magnitudes
of the spectral peaks in the spectral plots).
AM Demodulation
The signal φ (t) is demodulated by first taking its positive part (equivalent to rectification)
and then low-pass filtering. First, reset the modulation index to a=0.75 and the audio
frequency fm = 3. To demodulate this signal in MATLAB, create a new array pr whose
elements are the positive values of the elements of phi. (If phi(i) > 0, then pr(i) =
phi(i), else pr(i) = 0.) Take the spectrum of pr (and call it PR) using the fft()
function as in the previous section. We may then “filter” the spectrum PR by filtering out
the high-frequency components above 16 Hz. Create an array H which corresponds to the
“filter” (transfer) function. H is equal to one for frequencies above zero and less than 16
Hz and frequencies above 256-16 = 240 Hz and zero elsewhere. This H function
corresponds to a low-pass filter which also blocks D.C. components. The reason that we
have set the higher indices to one (above 240 Hz) is because of the “mirror” frequencies
described in Lab #1. The MATLAB commands are as follows
>> H = zeros(1,256);
>> H(2:9) = ones(1,8);
>> f = 0:126;
>> H(130:256) = H(128-f);
The “filtered” spectrum is created by taking the product of H and PR. Call this product
PRF. The corresponding filtered signal is found by taking the ifft() of the spectrum
array (PRF):
Inspect the spectrum of the rectified version of φ (t) (PR). This spectrum may be found
from the Fourier series of a half-wave rectified sinewave. (For details, refer to the handout
on the DSB-LC Demodulation.) Justify the magnitudes of the spectral lines in PR (by
reference to the handout).
FM Spectra
( )
φ(t ) = cos ωct + k f ∫ m(t ) dt .
where
m(t ) = cos ωmt ,
and where kf is the peak frequency deviation and β = kf/fm is the FM modulation index.
Proceeding in a similar manner to generating an AM waveform, generate a frequency-
modulated waveform with fc = 32, fm = 2 and β = 3.0. Plot the corresponding waveform.
Calculate the spectrum using the fft() function, and plot the spectrum. Calculate the
FM spectrum with β = 3 using the Bessel function tables and compare the calculations
with the plot.
FM Demodulation
One way to demodulate and FM signal is to first convert the FM signal to AM by using a
high-pass filter. We can perform the high-pass filtering operation by modifying the PHI
array. First, let's create a high-pass filter HPF:
>> f = 0:128;
>> HPF = ((f/32).^ 4) ./ (1 + (f/32).^ 4);
>> HPF = sqrt(HPF);
>> f = 0:126;
>> HPF(130:256) = HPF(128-f); (for mirror frequencies)
Plot this array (HPF). This array corresponds to the transfer function of the high-pass filter.
To “filter” the modulated waveform (phi), first take the fft(), then multiply the spectrum
(PHI) by the transfer function:
>> D1 = PHI.*HPF;
Finally, take the ifft() of D1. This array corresponds to the equivalent AM signal
corresponding to the FM signal. Plot this signal. This equivalent AM signal can be
demodulated the same way in which the AM signal was demodulated. Show this process
and plot-out the demodulated waveform. (There will be some distortion.)
Questions
1. How would you use MATLAB to compute the power in of φ (t)? Suggest at least
two different ways of doing this. (Hint: use Parseval's Theorem and find the power
from the time-domain function phi and the frequency-domain function PHI.)