Communication System Lab Manual
Communication System Lab Manual
Name: ____________________________
Page | 1
University College of Engineering & Technology ES-411 Fall 2011
Preface
Students will also carry out a design experiment in addition to the eleven
experiments provided in this lab manual. Students will be given a specific
design problem, which after completion they will verify the outcome using the
simulation software.
Page | 2
University College of Engineering & Technology ES-411 Fall 2011
Table of Contents
Page | 3
University College of Engineering & Technology ES-411 Fall 2011
Lab Activity 1:
Introduction to Simulink
What is SIMULINK?
Simulink is a software package that enables you to model, simulate, and analyze systems
whose outputs change over time. Such systems are often referred to as dynamic systems.
Simulink can be used to explore the behavior of a wide range of real-world dynamic
systems, including electrical circuits, shock absorbers, braking systems, and many other
electrical, mechanical, and thermodynamic systems.
Simulating a dynamic system is a two-step process with Simulink. First, a user creates a
block diagram, using the Simulink model editor, which graphically depicts time-dependent
mathematical relationships among the system’s inputs, states, and outputs. The user then
commands Simulink to simulate the system represented by the model from a specified start
time to a specified stop time.
Start up the Matlab (We use Matlab version 6.5.1 in this and the following experiments.),
type “simulink” (small letters!!) in the command window.
Fig. 1
In the “Simulink Library Browser” window, click “File”-> “New” -> “Model”
Page | 4
University College of Engineering & Technology ES-411 Fall 2011
Fig. 2
Page | 5
University College of Engineering & Technology ES-411 Fall 2011
Example 1:
Simulate Sine wave
Fig. 3
Page | 6
University College of Engineering & Technology ES-411 Fall 2011
Fig. 4
Fig. 5
Page | 7
University College of Engineering & Technology ES-411 Fall 2011
Fig. 6
Fig. 7
Fig. 8
Page | 8
University College of Engineering & Technology ES-411 Fall 2011
Example 2:
Use the “FFT” block as Spectrum Analyzer
1. Refer to Fig. 9 to set the diagram. To add “B-FFT”, choose “DSP Block set” -> “DSP
Sinks” -> “FFT Spectrum Scope”. Use Fig. 10 and Fig. 11 to set “FFT Scope”. After
you finish setting, the “FFT Scope” becomes “B-FFT Scope”.
2. To draw a line from an existing line to the spectrum scope, keep pressing “Ctrl”
button and then use the similar procedure of example1.
3. Use Fig. 4, Fig. 5 and Fig.7 to set environment and Sine source parameters.
4. Run the program and you should see the spectrum as shown in Fig. 12
Fig. 9
Page | 9
University College of Engineering & Technology ES-411 Fall 2011
Fig. 10
Fig. 11
Page | 10
University College of Engineering & Technology ES-411 Fall 2011
Fig. 12
Page | 11
University College of Engineering & Technology ES-411 Fall 2011
Example 3:
Product of Two Sine Waves
1. Refer to Fig. 13 to draw the system diagram. To add “ ” product, choose “Simulink”
-> “Math Operations” -> “Product”.
2. Use Fig. 14 and Fig. 15 to set parameters of “Sine 1” and “Sine 2”
3. Run the program and you should get picture of Fig. 16 and Fig. 17
Fig. 13
Page | 12
University College of Engineering & Technology ES-411 Fall 2011
Fig. 14
Fig. 15
Page | 13
University College of Engineering & Technology ES-411 Fall 2011
Fig. 16
Fig. 17
Page | 14
University College of Engineering & Technology ES-411 Fall 2011
Lab Review Questions:
Page | 15
University College of Engineering & Technology ES-411 Fall 2011
Lab Activity 2:
Objective:
• The objective of this lab is to help you become familiar with Simulink
• To investigate AM modulation
• To observe and measure the waveforms and spectra for Double sideband AM (DSBAM),
DSB Diminished Carrier and DSB Suppressed Carrier (DSBSC).
• To measure the power in DSB amplitude modulation.
Theory – AM Modulation:
The signal generator at 50 kHz represents the message signal, vm(t) = Vmcosωmt.
The signal generator at 500 kHz represents the carrier, vc(t)=cosωct.
The output modulated signal may be represented by:
Page | 16
University College of Engineering & Technology ES-411 Fall 2011
Modulation depth in AM is defined as m = Vm/VDC, hence changing the DC offset (VDC), is
one way of changing the modulation depth. Change the DC offset and observe the effect on
the waveforms and the output spectrum.
Procedure – AM Modulation
1. Start up Matlab.
2. Startup Simulink by clicking the Simulink icon in the Matlab toolbar or by typing
>> Simulink
At the Matlab prompt.
3. From the file menu, select new model. A Model window should open as shown below.
Page | 17
University College of Engineering & Technology ES-411 Fall 2011
4. We will start by building and testing an AM-DSB/SC modulator.
5. Open the Signal Processing Block set window in the Simulink Library Browser window.
This will open the Signal Processing Block set Library window which looks like this
Page | 18
University College of Engineering & Technology ES-411 Fall 2011
6. Right click on the Signal Processing Sources block in the Signal Processing Block Library
window and then choose Open the 'Sources' Library. The Sources Block Library should
open as shown below.
7. Drag and drop two Sine Wave blocks from the Sources Library to the Model
window.
8. Drag and Drop a DSP Constant block from the Sources Library to the Model window.
9. Open the Math Operations block in the Simulink Block Library window. The Math
Block Library window looks like this:
Page | 19
University College of Engineering & Technology ES-411 Fall 2011
10. Drag and drop one Product block and one Add block onto the Model window.
11. Open the Sinks block in the Simulink Block Library window. The Sinks Block
Library window should open as shown below.
Page | 20
University College of Engineering & Technology ES-411 Fall 2011
12. Drag and drop a Scope block onto the Model window. To obtain more than one
channel on your scope, Choose the scope ‘parameters’ icon (second from left) and
change the Number of axes to the desired amount:
13. Search for a ‘Spectrum Scope’ and drop it into the Model Window. You can search
for any block using the ‘search’ tool in the ‘Simulink Library Browser’ window.
14. You will want several of these scopes to view the signals and spectra. Make sure you
buffer the input of the Spectrum scope, by ticking the input as shown:
Page | 21
University College of Engineering & Technology ES-411 Fall 2011
15. Connect the blocks with signal flow lines to represent an AM modulator (find the
block diagram from your notes!). You can re-name blocks by clicking on their
original name.
16. The Model window should now look like this:
17. Add additional scopes and spectrum scopes to display all the required signals.
18. The simulation will be carried out at a sample rate of 1000,000 Hertz.
Page | 22
University College of Engineering & Technology ES-411 Fall 2011
19. Define the sampling period as 1000,000 Hertz by typing the following in Matlab
command window. >> fs = 10^6;
20. The sinusoidal carrier will have a frequency of 50 kHz and the message signal will
one of 500 kHz. Open vc(t) and vm(t) and set the following values:
21. Save your model by selecting Save as... in the File menu in the Model window. Call
this model lab_1.mdl.
22. Bring up the Simulation Configuration parameters... dialogue from the Simulation
menu in the Model window.
23. Under Simulation time, change the Stop time to 0.0002.
24. Under Solver options, change the Type to Fixed-step.
25. The Simulation Parameters window should look something like this.
Page | 23
University College of Engineering & Technology ES-411 Fall 2011
26. Set the values by clicking OK.
27. Next select Start from the Simulation menu in the Model window.
28. Open the Scope displays by double clicking on the scope. Then you should see
something like this:
Page | 24
University College of Engineering & Technology ES-411 Fall 2011
To get the pictures above, you will need to modify the plot properties of the scope.
Page | 25
University College of Engineering & Technology ES-411 Fall 2011
29. Keeping Vm constant, set the modulation depth to m = 0.5, m = 1, m = 2 and m =
infinity by varying the value of VDC and observe the different waveforms.
30. Reduce the sampling period as 100,000 Hertz by typing the following in Matlab
command window.
>> fs = 10^5;
31. Re-run the simulations for the different values of m and observe the output on the
Spectrum Scopes. Are the values what you expect from theory?
32. For each setting of modulation depth, m, observe and record the DSB waveform and
spectrum, including the voltage amplitude in each component. For each value of
modulation depth, measure the total power at the output on the power meter
provided.
Note how the waveforms, spectrum and power relate to modulation depth. Note when
m > 1, the phase of the DSB envelope alternates between 0 and 180 degrees.
Page | 26
University College of Engineering & Technology ES-411 Fall 2011
Lab Review Questions:
Q. Compare your results with what you would expect from theory, i.e. for the
waveform, spectra and power?
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
Page | 27
University College of Engineering & Technology ES-411 Fall 2011
Lab Activity 3:
AM-DSB/SC Modulation
Objective:
The objective of this lab is to help students become familiar with Simulink and amplitude
modulation.
Procedure:
1. Start Matlab.
2. Initiate Simulink by typing at the Matlab prompt.
>> Simulink
You should see the Simulink Block Library window as shown below.
3. From the file menu, select new model. A Model window should open as shown
below.
Page | 28
University College of Engineering & Technology ES-411 Fall 2011
4. We will start by building and testing an AM-DSB/SC modulator.
5. Click on the Sources block in the Simulink Block Library window. The Sources
Block Library should open as shown below.
6. Drag and drop a Sine Wave block from the Sources Library to the Model window.
7. Click on the Block sets & Toolboxes block in the Simulink Block Library window.
The Block sets and Toolboxes window will open as shown below.
Page | 29
University College of Engineering & Technology ES-411 Fall 2011
8. Open the DSP Block set window by double clicking. This will open the DSP Block
set Library window.
9. Finally when you open the DSP Sources window you will see this.
10. Drag and drop the Signal from Workspace block into the Model window.
11. Click on the Math block in the Simulink Block Library window. The Math Block
Library window should open as shown below.
Page | 30
University College of Engineering & Technology ES-411 Fall 2011
12. Drag and drop the Product block onto the Model window.
13. Click on the Sinks block in the Simulink Block Library window. The Sinks Block
Library window should open as shown below.
14. Drag and drop the one Scope and one To Workspace block onto the Model window.
Page | 31
University College of Engineering & Technology ES-411 Fall 2011
15. Connect the blocks with signal flow lines.
16. The Model window should now look like this.
17. Open the Sine Wave block by double clicking on it. Set the parameters as follows.
18. Click OK when you are done to set the parameters of the Sine Wave block.
19. In the Matlab Command Window define the signal bumps by typing the following.
Page | 32
University College of Engineering & Technology ES-411 Fall 2011
21. This signal is 5000 samples long and will be used as the modulating signal for our
AM-DSB/SC modulator.
22. To let Simulink know that we want this for our source signal, double click the From
Workspace block in the Model window and set the Parameters as shown below.
Page | 33
University College of Engineering & Technology ES-411 Fall 2011
23. Double click the To Workspace block in the Model window and set the Parameters
as shown below.
When you are done the To Workspace Parameter window should look like this.
24. Save your model by selecting Save as... in the File menu in the Model window. Call
this model lab1.mdl.
25. Bring up the Simulation parameters... dialog from the Simulation menu in the Model
window.
26. Under Simulation time, change the Stop time to 5000.
27. Under Solver options, change the Type to Fixed-step.
28. The Simulation Parameters window should look something like this.
Page | 34
University College of Engineering & Technology ES-411 Fall 2011
29. Set the values by clicking OK.
30. Next select Start from the Simulation menu in the Model window.
31. Open the Scope display by double clicking on the scope. Then you should see
something like this.
Page | 35
University College of Engineering & Technology ES-411 Fall 2011
You can zoom in to verify that this is an amplitude modulated wave corresponding
to the modulating signal given above.
32. By entering the following in the Matlab Command Window, you can see that the
original modulating signal has been moved from baseband to the carrier frequency
at 0.3.
>> NFFT=2^16;
>> f=[0:NFFT-1]/NFFT;
>> AM=abs(fft(am(1,:).*blackman(length(am)).',NFFT));
>> plot(f,20*log10(AM));
>> axis([0 0.5 -20 80]);
Page | 36
University College of Engineering & Technology ES-411 Fall 2011
Lab Review Questions:
Q1. Write a Matlab function that will display the spectrum of a signal. Here's some code
that you may want to try: sigspec.m
function sigspec(sigin,flag)
if(nargin==0)
disp('USAGE: sigspec(sigin,flag)');
disp(' The input signals should be in the columns of sigin.');
disp(' flag=0 produces a linear magnitude plot (default)');
disp(' flag=1 produces a log magnitude plot (dB)');
return;
end
if(nargin==1)
flag = 0;
end
[len,numsigs]=size(sigin);
if(len<numsigs)
sigin = sigin.'; % Force the signals into the columns of sigin
tmp = len;
len = numsigs;
numsigs = tmp;
end
Q2. In the simulink model created above, there are three signals: (1) the modulating
signal, (2) the carrier signal, (3) the modulated signal. The modulating signal and
the modulated signal should already exist in the Matlab workspace. Add another To
Workspace block to the model and connect it to the carrier signal. Run the
simulation. Then all three signals should exist in the Matlab workspace. Use the
sigspec.m function that you wrote previously to plot the spectra of the three signals.
Plot all three signals in the same figure window but in different axes. Use the
subplot function in Matlab to accomplish this. If you have never used subplot, at the
Matlab prompt, type
Q3. Print a hard copy of the plots and paste below. Write an explanation of the three
plots. Comment on the scaling of the modulated signal relative to the modulating
signal. The scaling should be one half in the linear scale and -3dB on the log scale.
Page | 37
University College of Engineering & Technology ES-411 Fall 2011
To get an accurate measurement, you may need to zoom in to read off the correct
value of the peak. A log plot would look something like this
Page | 38
University College of Engineering & Technology ES-411 Fall 2011
Paste your Lab Results here:
Page | 39
University College of Engineering & Technology ES-411 Fall 2011
Lab Activity 4:
Objective
Procedure:
2. Get the MAT-file sig1.mat from your teacher and download it to your Lab 2 working
directory.
3. At the Matlab prompt type
This will load the variable x into the Matlab workspace. Use this as the modulating
signal in your simulation.
Page | 40
University College of Engineering & Technology ES-411 Fall 2011
7. Note that the "double frequency" terms show up at normalized frequency 0.4 instead
of 0.6 where they should be. This is due to aliasing and we will talk about it later.
For now, the important thing to realize is that we have to design the low pass filter
to pass the baseband component of z(t) and remove the component at 0.4.
Page | 41
University College of Engineering & Technology ES-411 Fall 2011
8. An FIR equi-ripple filter that will do the job can be designed using the Matlab code
The first argument in the remez function is the filter order. The length of the filter is
one more than the order. In this case, the resulting filter is a 31 tap FIR filter. The
second argument is a vector containing the frequencies of the filter bands. The pass
band extends from [0 to 0.1] and the stop band extends from [0.3 to 0.5]. Notice
these two bands in the figure below. When using remez, don't forget to multiply the
desired band frequencies by 2. The last argument is a vector that says the desired
response should be [1 and 1] at the frequencies [0 and 0.1]. The response should be
[0 and 0] at the frequencies [0.3 and 0.5]. You can change the response of filters
designed with the remez function by changing the filter and changing the filter band
edge frequencies. For more information see the help for the remez function.
9. Use your spectrum plotting function to plot the magnitude response of the filter on
top of the spectrum of y(t). The plot should look something like this
10. Add the low pass filter to you model. The easies block to use is the Discrete Filter
block in the discrete block library. The interface for this block is simple. If you
called the filter you designed B; then put B in the numerator of the discrete filter. Let
the denominator be 1.
Page | 42
University College of Engineering & Technology ES-411 Fall 2011
11. Add a To Workspace block to capture the signal w(t). Plot the spectra of the signals
x(t), y(t), z(t), and w(t) in the same figure window but in different axes. Your plot
may look something like this
Page | 43
University College of Engineering & Technology ES-411 Fall 2011
Lab Review Questions:
Q1. Write an explanation of the signal spectra at each point. Is the scaling appropriate?
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
Q2. Paste the spectral plots and write an explanation for it?
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
Page | 44
University College of Engineering & Technology ES-411 Fall 2011
Lab Activity 5:
AM-DSB/SC, Carrier Frequency Offset, Sinusoidal Carrier
Objective
Procedure:
Page | 45
University College of Engineering & Technology ES-411 Fall 2011
Lab Review Questions:
Q1. Plot x(t) and w(t) and write an explanation of why w(t) does not look like x(t). How
important is accurate carrier frequency synchronization? Turn all of this to your
teacher.
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
Page | 46
University College of Engineering & Technology ES-411 Fall 2011
Lab Activity 6:
Objective
Procedure:
Page | 47
University College of Engineering & Technology ES-411 Fall 2011
Lab Review Questions:
Q1. Make spectral plots of the three signals x(t), y(t), and w(t). Write an explanation and
turn it to the teacher.
__________________________________________________________________________
__________________________________________________________________________
__________________________________________________________________________
__________________________________________________________________________
__________________________________________________________________________
Page | 48
University College of Engineering & Technology ES-411 Fall 2011
Lab Activity 7:
Objective
Procedure:
3. Roughly the operation of this circuit is as follows. When the input voltage is greater
than the output voltage, the output voltage tracks the input. When the input voltage
falls below the output voltage, the output voltage decays exponentially with time
constant 1/RC. This functionality is easy to build into a Simulink model shown
below.
Page | 49
University College of Engineering & Technology ES-411 Fall 2011
4. The parameters for the MATLAB Fcn block are as shown here.
5. The value 0.05 in the exponential is the value of T/RC where T is the time between
samples. In this case T=1 because we are assuming a sample rate of one sample per
second. The Matlab function implements the logic described above--output the
input if the input is greater than the output otherwise output a decayed version of
the previous output. This was described in step 3 above.
6. Note that the operation of the diode has been replaced by the Abs function. This
means that we are tracking the envelope of the absolute value of the signal rather
than the positive part of the signal.
7. Add the rest of the blocks as shown below and run the simulation to see the
operation of the envelope detector.
Page | 50
University College of Engineering & Technology ES-411 Fall 2011
8. Set the frequency of the Sine Wave block to 0.04 and set the Simulation Parameters
as shown here.
Page | 51
University College of Engineering & Technology ES-411 Fall 2011
9. Double click the scope display and you will see this.
10. The cyan line is the sine wave source, the magenta line is the rectified signal, and the
yellow line is the envelope detected signal. Change the 1/RC (see step 5 above)
constant and the frequency of the sine wave source and see how the envelope
changes.
11. Now you are ready to build the AM-DSB/WC modulator and the synchronous
demodulator in Simulink. Use a carrier frequency of 0.3. Use a Sine Wave block as
the modulating signal x(t). Let the frequency of this signal be 0.003. Remember that
envelope detectors need the carrier frequency to be much greater than the highest
frequency in the modulating signal.
12. Before you add the final low pass filter, use To Workspace blocks to extract the
modulating signal x(t) and the envelope detector output z(t). Plot the spectra of x(t)
and z(t)-A using the function you wrote for Lab 1. When I did this, I got the
following.
Page | 52
University College of Engineering & Technology ES-411 Fall 2011
Page | 53
University College of Engineering & Technology ES-411 Fall 2011
13. The lower figure is a zoom of the upper figure around DC. You can see that the
envelope detector output z(t)-A differs from the modulating signal x(t) by some
extra high frequency components and component at DC. These spectral plots should
give you some ideas on how to design the low pass filter to remove the high
frequency components in z(t)-A. For illustration, the following figure shows x(t) and
z(t)-A. Which one is which?
14. Complete the asynchronous demodulator by designing the low pass filter and
filtering z(t)-A to produce w(t). The following figure shows x(t) and w(t). Which
one is which? Is w(t) close enough to x(t) to be acceptable?
Page | 54
University College of Engineering & Technology ES-411 Fall 2011
Lab Review Questions:
Q. Print and turn in plots of the signals x(t), y(t), z(t), and w(t). Also print and plots
of the spectra of x(t) and z(t)-A. Plot the magnitude response of the low pass filter
you applied to z(t)-A to produce w(t). Explain how you selected the filter
parameters (cut off frequency, gain, etc.). Turn all of this to the teacher.
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
Page | 55
University College of Engineering & Technology ES-411 Fall 2011
Lab Activity 8:
Figure 1
In our simulation, we use a VCO to generate FM signal. Fig. 2 is the modulation procedure:
Page | 56
University College of Engineering & Technology ES-411 Fall 2011
2. Lab Procedure
Given the following parameters, you are expected to finish the FM modulation and
demodulation. You may refer to the attached figure to setup diagram, but you are greatly
encouraged to add or change any blocks. You need to include in your lab report the whole
diagram and the results of scope1-6 and spectral1-2, or any other scopes you add.
Page | 57
University College of Engineering & Technology ES-411 Fall 2011
Fig. 5
Page | 58
University College of Engineering & Technology ES-411 Fall 2011
Lab Review Questions:
Q1. We use “Gain1” and “Gain2” in this simulation. Why we put them here? What
values do you use?
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
Q3. Give out your parameters for important blocks (VCOs, Filters, Spectral scopes, etc.)?
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
Q4. Give out your environmental settings (simulation time, sampling rate, max step
time, etc.)?
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
Page | 59
University College of Engineering & Technology ES-411 Fall 2011
Lab Activity 9:
Objective:
1. In this lab, you will experiment with up & down sampling by a factor of 3.
2. First, download the file h.mat and type load h at the Matlab prompt. This will load a
variable h into the Matlab workspace.
3. Startup Simulink and build up and down sampling models.
4. Recall that down sampling requires two processing blocks: (1) modulation with a
periodic impulse train {..., 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, ...} and (2) removing the zero
samples.
5. An easy way to modulate by the {..., 1, 0, 0, 1, 0, 0, ...} sequence is to define the
sequence in the Matlab workspace and then bring it into the model using a Signal
From Workspace block. Here's some code to consider.
6. The Signal Operations Block Library in the DSP Block set Library contains a Down
sample block which removes zero samples. It looks like this
7. Up sampling consists of two operations: (1) inserting zeros and (2) low-pass filtering
to remove images.
8. This Signal Operations Block Library in the DSP Block set Library contains an Up
sample block which inserts zeros. It looks like this
9. You already know about designing low-pass filters using the Matlab remez function.
10. The following is an example Simulink model. The upper branch does down
sampling and the lower branch does up sampling.
11. Note: In up and down sampling, be very careful to set the sample rates in each
block. When available, set the "Sample Time" in the filter blocks to -1. Then the
Page | 60
University College of Engineering & Technology ES-411 Fall 2011
filters will "inherit" their sample times from the previous block. Otherwise, you
must set the sample times explicitly.
12. In this model, a few Signals to Workspace blocks have been added to capture
various signals.
13. In the Simulation Parameters Dialog, set the Start time to 0 and the Stop time to N-1
where N is the length of the input signal h. Also, in the Solver options category set
the Type to Fixed-step.
14. Run the simulation.
15. Compare the spectra and time-domain sequences of the three signals: h, hpd, h
down. Write an explanation of what you see. Do the two processing blocks used for
the down sampling function as expected? Turn plots like the ones shown below
with your write up.
16. Below are the spectra and time-domain sequences (first few samples only) computed
using the Simulink model above?
Page | 61
University College of Engineering & Technology ES-411 Fall 2011
Page | 62
University College of Engineering & Technology ES-411 Fall 2011
17. Compare the spectra and time-domain sequences of the three signals: h, hpu, hup.
Write an explanation of what you see. Do the two processing blocks used for up
sampling function as expected? Turn plots like the ones shown below with your
write up.
18. Explain how you designed the low-pass filter for up sampling. What were the edges
of the transition band? What was the gain of the filter?
19. Below are the spectra and time-domain sequences (first few samples only) computed
using the Simulink model above?
Page | 63
University College of Engineering & Technology ES-411 Fall 2011
Page | 64
University College of Engineering & Technology ES-411 Fall 2011
As shown above, the up sampled time-domain sequence passes through the samples of the original
signals. This is achieved using a gain of 3 in the low pass filter. You can see the gain of three in the
frequency domain. Note that the low-pass filter will cause a delay in the up sampled signal relative
to the original signal. In the figure above, the delay has been removed.
Page | 65
University College of Engineering & Technology ES-411 Fall 2011
Lab Activity 10:
Objective:
1. Download the file y.wav . Any multimedia equiped computer with standard
software packages should be able to play this audio file. Try it. Do you recognize
what the woman is reading?
2. You can read the wav data into Matlab by typing:
[y,fs,nbits]=wavread('y.wav');
This loads three variables into you Matlab workspace: y is the audio data, fs is the
sample rate (11025 in this case), and n-bits is the number of bits used to represent
each sample in y.
Page | 66
University College of Engineering & Technology ES-411 Fall 2011
4. As you can see, y contains significant frequency content all the way out to 0.5
(discrete-time frequency) which corresponds to 11025/2 Hz (continuous-time
frequency) half the sample rate.
5. Build a Simulink model to amplitude modulate y on a co-sinusoidal carrier using a
carrier frequency of 0.2 (discrete-time frequency) and then perform synchronous
demodulation and down sampling to restore the spectrum to its original shape.
6. In order to avoid aliasing, y must be up sampled before modulating it.
7. Recall that in discrete-time, the constraint on the carrier frequency is
Where these frequencies are discrete-time frequencies in units of rads. If you would
rather use units that are consistent with the way that we generate our plots, then
divide the inequality above by a factor of (2 pi) leading to the following constraint on
the carrier frequency.
wavwrite(yr,fs,nbits,'yr.wav');
15. Turn in your answers to the questions above and figures like the ones below
showing your model and the spectra. An example of what the spectra look like at
various points appears at the bottom of this page.
16. A Simulink Model of the complete system may look like this.
Page | 67
University College of Engineering & Technology ES-411 Fall 2011
Page | 68
University College of Engineering & Technology ES-411 Fall 2011
17. The spectra of several of the intermediate signals looks like this.
Page | 69
University College of Engineering & Technology ES-411 Fall 2011
Paste your Lab Results here:
Page | 70
University College of Engineering & Technology ES-411 Fall 2011
Lab Activity 11:
BPSK/QPSK Modulation and Demodulation
Objective
The objective of this lab is to learn about BPSK and QPSK by building a QPSK modulator
and demodulator.
1. Start Simulink.
2. Open up your final model from Lab 6. The essential elements in this model are:
o Binary source
o Look up table for converting bits to symbols
o Impulse generator (up sample block)
o Pulse generator (transmitter pulse filter)
o Additive white Gaussian noise channel
o Delay block (implemented by a filter)
o The linear receiver (implemented by a matched filter and a down sample
block)
3. In this lab, we want to build a QPSK modulator.
4. Use the "Save as..." option in the file menu to create a new copy of your linear
receiver model. Use the new copy as the starting point in this lab to create your
QPSK modulator and demodulator. Starting in this way, you will already have most
of the blocks that you need for this lab.
5. Replace the Bernoulli Binary Generator in your model with a Random Integer
Generator
o Communication Block set -> Communication Sources -> Data Sources ->
Random Integer Generator
6. Set the M-array Number in the Random Integer Generator parameter dialog to 4 as
shown below.
Page | 71
University College of Engineering & Technology ES-411 Fall 2011
The Random Integer Generator block is now configured to output the numbers 0, 1,
2, and 3 at random. Think of this block as the source. Instead of generating pairs of
bits (00), (01), (10), and (11) it generates the integers 0, 1, 2, and 3. We can use 0, 1, 2,
and 3 in a look table to generate symbols as easily as we can the bit patterns. Let's
define the look up table next.
7. Change the Look-Up Table to reflect the QPSK symbols as shown below.
Page | 72
University College of Engineering & Technology ES-411 Fall 2011
Page | 73
University College of Engineering & Technology ES-411 Fall 2011
This figure is color coded as follows.
Page | 74
University College of Engineering & Technology ES-411 Fall 2011
Page | 75
University College of Engineering & Technology ES-411 Fall 2011
You can see the constellation showing up perfectly. Of course, I didn't scale my
pulses to have unit energy. The eye diagram at the output of the matched filter is
also fully open because we used a square-root Nyquist (shift-orthogonal) pulse.
Plot the spectra of these signals in Matlab using the sigspec.m function.
Page | 76
University College of Engineering & Technology ES-411 Fall 2011
25. Next add 0.3 radians to the phases of the cos and sin blocks at the receiver. This
simulates demodulating with the wrong carrier phase. Run the simulation again.
The MF output eye diagram and the scatter plot should look like this.
Page | 77
University College of Engineering & Technology ES-411 Fall 2011
Lab Review Questions:
Q1. Explain the relationship between the eye diagram at the MF output and the scatter
plot. Why is the scatter plot rotated?
__________________________________________________________________________
__________________________________________________________________________
__________________________________________________________________________
__________________________________________________________________________
__________________________________________________________________________
__________________________________________________________________________
__________________________________________________________________________
Page | 78
University College of Engineering & Technology ES-411 Fall 2011
Now add some noise to the simulation. Set the variance in the Gaussian Noise
Generator to 1. Run the simulation. They eye and scatter plots should look something
like this.
Page | 79
University College of Engineering & Technology ES-411 Fall 2011
Page | 80
University College of Engineering & Technology ES-411 Fall 2011
Lab Review Questions:
Q1. Describe the effect of noise on the scatter plot and the eye diagram.
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
Q2. How would you modify your model if you were running a BPSK simulation?
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
Page | 81
University College of Engineering & Technology ES-411 Fall 2011