ملزمة سميولنك-ماتلاب النهرين

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 43

Exp.

1 Communication Lab

Exp.1
Getting Started with MATLAB

Objectives: To be familiar with building communication systems using Simulink library and script,
make analysis and numerical or graphical outputs.

Procedure:
A- How to use Simulink model
There are 3 ways to write or draw a simulation system.
1. Press New Simulink model untitled

Fig. 1

Stop
Run
Simulink Library
Browser

Fig.2

Page1
Exp.1 Communication Lab

• Press Simulink library button. The window as in Fig.3 will appear.

Fig. 3
2. Write commands in the MATLAB Command window
Example:
>>simulink press enter, the Simulink library will be shown. Drag & drop a block to
the model file.
>>commlib press enter after each command. This opens the communication block
set within main library.

3. Press Simulink library button in the main MATLAB Window, see Fig.4, is the easiest way to
get access and simulate a communication system.
Note: You can connect between blocks in the model by simply, positioning the pointer of the
mouse over the first block's output port and drag the pointer to the second block's input port.

Fig. 4

Page2
Exp.1 Communication Lab

Model Overview for This Tutorial


You can use Simulink® to model a system and then simulate the dynamic behaviour of that system.
The basic techniques you use to create a simple model in this tutorial are the same techniques that
you use for more complex models.
To create this simple model, you need four blocks:
• Sine Wave (found in Sources library) — Generates an input signal for the model.
• Integrator (found in Commonly Used library) — Processes the input signal.
• Bus Creator (found in Commonly Used library) — Combines the input signal and processed
signal into one signal.
• Scope (found in Commonly Used library) — Visualizes the signals.

Simulating this model integrates a sine wave signal to a cosine signal and then displays the result,
along with the original signal, in a scope window.

Open the Simulink Library Browser


From the Simulink Library Browser, you can create a new model (block diagram) and search for
blocks that you want to use in your model. You need MATLAB® running before you can open the
Simulink Library Browser.
1. From the MATLAB Toolstrip, click the Simulink Library button , or in the Command
Window, enter Simulink. A short delay occurs before the Simulink Library Browser opens.

Page3
Exp.1 Communication Lab

2. In the Simulink Library Browser, select View > Stay on Top to keep the Library Browser on top
of the other windows on your desktop.

Browse or Search for Specific Blocks


You can search all of the available block libraries at once.
1. Browse for the block. In the Libraries pane on the left, select Simulink, and then select
the Sources library. From the Library displayed in the right pane, select the Sine Wave block.

2. Search for a block. In the search box, enter a block name or part of a block name. For example,
enter sine, and then click the Search button .
3. Get detailed information about a block. Select the block, and then from the menu bar,
select Help > Help for the Selected Block. The Help browser opens with the reference page for
that block.
4. View block parameters. Right-click a block, and then select Block Parameters. The block
parameters dialog box opens.

Open the Simulink Editor


In the Simulink Editor, you can build and simulate models of your system. You need the Simulink
Library Browser open before you can create a new Simulink model.
1. From the Simulink Library Browser Toolstrip, click the New Model button , or from the
menu bar, select File > New > Model.
A Simulink Editor window opens with a new block diagram in the right pane.
2. Select File > Save as. In the File name text box, enter a name for your model. For example,
enter simple_model, and then click Save.
Simulink saves your model with the file name simple_model.slx.

Page4
Exp.1 Communication Lab

Add Blocks to a Model


To build a model, begin by copying blocks from the Simulink Library Browser to the Simulink
Editor.
1. In the Simulink Library Browser, select the Sources library. The Library Browser displays blocks
from the selected library in the right pane.
2. Select the Sine Wave block, and then drag the block to the block diagram.

A copy of the Sine Wave block appears in your model.


3. Add the following blocks to your model, using the same approach that you used to add the Sine
Wave block.
Library Block
Sinks Scope
Continuous Integrator
Signal Routing Bus Creator
4. Your model now has the blocks you need for the simple model.

Move and Resize Blocks


Before you connect the blocks in your model, arrange them logically to make the signal connections
as straightforward as possible.
1. Move the Scope block after the Bus block output. You can either:
• Click and drag a block.
• Select the block, and then press the arrow keys on your keyboard.
2. Move the Sine Wave and Integrator blocks before the Bus block.
Move the blocks until your model looks similar to the following figure.

Page5
Exp.1 Communication Lab

Simulink Block Connections


After you add blocks to your model, you need to connect them. The connecting lines represent the
signals within your model.
Most blocks have angle brackets on one or both sides. These angle brackets represent input and
output ports:
• The > symbol pointing into a block is an input port.
• The > symbol pointing out of a block is an output port.

Draw Signal Lines Between Blocks


Connect the blocks by drawing lines between output ports and input ports.
1. Position the cursor over the output port on the right side of the Sine Wave block.
The pointer changes to a cross hair (+) while over the port.
2. Click, and then drag a line from the output port to the top input port of the Bus block.
While you are holding down the mouse button, the connecting line appears as a red dotted arrow.

3. Release the mouse button when the pointer is over the output port.

Page6
Exp.1 Communication Lab

Simulink connects the blocks with a line and an arrow indicating the direction of signal flow.

4. Connect the output port of the Integrator block to the bottom input port on the Bus block using
this alternative procedure:
a. Select the Integrator block.
b. Press and hold the Ctrl key.
c. Click the Bus block.
The Integrator block connects to the Bus block with a signal line.

Note: The Ctrl+click shortcut is useful when you are connecting widely separated blocks
or when working with complex models.
Connect the Bus block output port to the Scope block.

Draw Branched Signal Lines


Your simple model is almost complete. To finish the model, connect the Sine Wave block to the
Integrator block.
This connection is different from the other connections, which all connect output ports to input ports.
Because the output port of the Sine Wave block is already connected, you must connect this existing
line to the input port of the Integrator block. The new line, called a branch line, carries the same
signal that passes from the Sine Wave block to the Bus block.

Page7
Exp.1 Communication Lab

1. Hold down the Ctrl key.


2. Position the cursor where you want to start a branch line. Click, and then drag the cursor away
from the line to form a dotted-red line segment.

3. Drag the cursor to the Integrator input port, and then release the mouse button.
4. Drag line segments to straighten and align with blocks. Your model is now complete.

Define Simulation Parameters


Before you simulate the behavior of a model, define the simulation parameters. Simulation
parameters include the type of numerical solver, start and stop times, and maximum step size.
1. From the Simulink Editor menu, select Simulation > Model Configuration Parameters. The
Configuration Parameters dialog box opens to the Solver pane.
2. In the Stop time field, enter 20. In the Max step size field, enter 0.2.

Page8
Exp.1 Communication Lab

3. Click OK.

Run Simulation
After you define Model Configuration Parameters, you are ready to simulate your model.
1. From the Simulink Editor menu bar, select Simulation > Run.
The simulation runs, and then stops when it reaches the stop time specified in the Model
Configuration Parameters dialog box.

Tip Alternatively, you can control a simulation by clicking the Run simulation button
and Pause simulation button on the Simulink Editor toolbar.

Observe Simulation Results


After simulating a model you can view the simulation results in a Scope window.
1. Double-click the Scope block.
The Scope window opens and displays the simulation results. The plot shows a sine wave signal
with the resulting cosine wave signal from the Integrator block.

2. From the Scope block toolbar, click the Parameters button . Select the Style tab. The Scope
Parameters dialog box displays figure editing options.

Page9
Exp.1 Communication Lab

3. Change the appearance of the figure. For example, select white for the Figure color and Axes
background color (icons with a pitcher) and black for the Ticks, labels and grid colors (icon with
a paintbrush). Change the signal line colors for signal 1 to blue and for signal 2 to green. To see
your changes, click OK.

4. Select File > Close > Close Model. The Simulink Editor closes with changes to your model and
the model configuration parameters.

Lab Work
1- Having sine block to obtain and draw cosine.
2- Apply the derivative on the output at the previous step. What is the output?
3- Apply the integral and derivative on the sine.

Page10
Exp.1 Communication Lab

B- How to use Script

To write a script in MATLAB:


1. Press New script untitled as shown in figure below
2. Save the code file as (.m) file.

Code Overview for Tutorial

t=(0:1/100:1); %time
f=1; %freq. f = 1/T
z=sin(2*pi*f*t); % pi = 180
plot(t,z); % To plot x-axis and y-axis
grid on;

Lab Work
1- Draw the cosine.
2- Use subplot(2,1,1) to sketch the sine and cosine at the same figure.

Page11
Exp.1 Communication Lab

Page12
Exp.2 Communications Lab

Exp.2
Mathematical Operations with Simulink
Objectives: The objective of this lab is to perform some mathematical operations using Simulink
models. Also, observing the signals outputs using logging and recording features.

Procedure:
A)
1. Connect the block diagram shown in Figure 1.

Figure 1: Gain Operation for Sine Wave Signal.

2. Set the Gain blocks as: Gain1=3; Gain2=2; and the Sine Wave1 block as: f =100 Hz.
3. Plot the output Signals and compare between the two types.
4. Adjust the parameters of the Sine Wave2 so that the output signals are identical in terms of
both frequency and amplitude. (You may use x-axes zoom to display outputs properly)
5. Verify the frequency parameter you set by comparing it with the frequency output.
B)

1. Connect the block diagram shown in Figure 2.

Figure 2: Multiplication of two signals

Page1
Exp.2 Communications Lab

2. Set the parameters of the blocks as follow:


Sine wave: (Amplitude = 1 Volt; frequency = 10 Hz
Pulse generator: (Amplitude = 2 Volts; frequency = 10 Hz; Pulse width = 25%)
3. Plot the two inputs signals with the output signal.
4. Increase the pulse width (duty cycle) of the pulse signal to 50% and then to 99% and notice
the output signals. To model that and plot it, you may add two additional Pulse Generator
blocks with two more Product blocks with keeping only one Sine Wave block.
5. As you have seen, the model becomes more complex when we need to adjust parameters
(pulse width in this example) and notice outputs.
To keep the model as it was in figure 1 with noticing the change in output while changing
some parameters, we may do signals logging and recording as follow:
For Matlab R2014:
a) Set the simulation end time to 1. (This is just to make the output clearer).
b) Set the pulse width to 25%.
c) Select the output link (Product output), then click on the arrow beside the button,
and press on Log/Unlog Selected Signals. (This step is to select the signal to be logged).
d) Press on the button to toggle on/off the recording.
e) Run the simulation
f) Adjust the pulse width parameter to 50%, then rerun the simulation
g) Again, increase the pulse width to 99% and rerun the simulation
h) Click on the arrow beside the button and select Simulation Data Inspector. (this is
where you can inspect output signals and compare between them).
i) Select the three data sets for the three running times we performed.

For Matlab R2012:


a) Set the simulation end time to 1. (This is just to make the output clearer).
b) Set the pulse width to 25%.
c) Right click on the Product output < Signal Properties < check on Log signal data. (This
step is to select the signal to be logged).
d) Go to Tools < Inspect Logged Signals, then click on the button to start recording.
e) Run the simulation
f) Adjust the pulse width parameter to 50%, then rerun the simulation
g) Again, increase the pulse width to 99% and rerun the simulation
h) Go to Tools < Inspect Logged Signals
i) Select the three data sets for the three running times we performed.
6. Plot the three output signals.

Page2
Exp.2 Communications Lab

C)
1. Connect the block diagram shown in the figure below.

2. After setting sample time in impulse1 at 3 , and impulse2 at 1, find the output.

Page3
Exp.2 Communications Lab

Tasks:

1. Add two constants, and draw the output signal. (1 M)


2. Repeat done the previous step, with Product Operation, and draw the output signal.
(1 M)
3. Add two sine waves, with periods ( 1, 0.5, 0.25 sec) for each one, and draw the output signal for
each period. (2 M)
4. Find the block diagram for the following output (3 M)

5. Having Discrete Impulse, Find the block diagram for the following output (3 M)

Page4
Exp.3 Wireless Communications Lab

Exp.3
Spectrum Representation and Mathematical Operations

Objectives: The objectives of this lab are to:


 Show the frequency representation (spectrum) of sinusoids theoretically and using Simulink
 Perform some mathematical operations.
 Perform convolution between discrete signals.

Procedure:
A)
1. The spectrum (frequency representaion) of sinusoidal signals is given as follow:

Page1
Exp.3 Wireless Communications Lab

Example:

2. Think and Discuss

Page2
Exp.3 Wireless Communications Lab

3. Now, model the figure 1, and set the frequencies to 100, 200, 300 Hz; amplitudes to 1, 0.5,
0.25 and the sample time at 0.001s. show the spectrum before and after the addition
operation.

Figure. 1: Spectrum representation


B)
1. Connect the block diagram shown in Figure 2.

Figure 2: Amplification of sinusoidal signals.

2. Set the Gain blocks as: Gain1=3; Gain2=2; and the Sine Wave1 block as: f =100 Hz.
3. Plot the output signals and compare between the two types.
4. Adjust the parameters of the Sine Wave2 so that the output signals are identical in terms of
both frequency and amplitude. (You may use x-axes zoom to display outputs properly)
5. Show the spectrum of the figure shown above.

Tasks:
Give an example in how to use fft block to find the spectrum of signal.

Page3
Exp.4 Wireless Communications Lab

Exp.4
Amplitude Modulation AM

Objectives:
The goal of this lab is to explore amplitude modulation AM and demodulation. Two
amplitude modulation schemes are simulated: double side band suppressed carrier
(DSB-SC) , DSB-LC and single side band (SSB).

Theory:
Modulation is defined as the process by which a property of a signal is varied in
proportion to a second signal. Amplitude modulation is characterized by the fact that
the amplitude of a carrier is varied in proportion to the baseband (message) signal, the
modulating signal.
Refer to your lecture notes for the theoretical part for further details in terms of
modulation and demodulation techniques.

Procedure:

A) Amplitude Modulation Double Side Band – Suppressed Carrier (AM-DSB-SC)

1. Model the schematic design as shown below.

2. Set the simulation stop time to 20.


3. Set the parameters of the blocks as shown below.

Signal Generator: Zero-Order Hold:


The signal generator is used to generate The zero-order hold block is used to
the message signal m(t). convert the continuous signal to discrete.
 Wave Form: Sine.  Sample Time: 0.01.
 Time (T): Use Simulation Time.
 Amplitude: 4 Volt.
 Frequency: 0.5 Hz.

Page1
Exp.4 Wireless Communications Lab

DSBSC AM Modulator Pass band: DSBSC AM Demodulator Pass band:


 Carrier Frequency: 25 Hz.
 Carrier Frequency: 25 Hz.
 Initial Phase (rad): 0
 Initial Phase (rad): 0
 Input Signal Offset: 0
 Low Pass Filter Design Method:
Butterworth.
 Filter Order: 4.
 Cut off Frequency: 0.7 Hz.

4. Plot message, modulated, and demodulated signals at points A, B, and C,


respectively in time domain using a single scope block.
5. Plot the spectrum of modulated and demodulated signals using Spectrum
Analyzer blocks.

Task 1:
a) Calculate the frequency and the no. of samples/cycle of the modulated signal from
the output plot.
b) From the spectrum analyzer, find the bandwidth and sketch (single-sided band)
both the modulating and modulated signals with their values.

B) Amplitude Modulation Single Side Band (AM-SSB)

1. Model the schematic design as shown below.

2. Set the simulation stop time to 20.


3. Set the parameters of the blocks as shown below.

Page2
Exp.4 Wireless Communications Lab

Signal Generator: Zero-Order Hold:


To generate the message signal m(t).  Sample Time: 0.01.
 Wave Form: Sine.
 Time (T): Use Simulation Time.
 Amplitude: 4 Volt.
 Frequency: 0.5 Hz.

SSB AM Modulator Pass band: SSB AM Demodulator Pass band:


 Carrier Frequency: 25 Hz.
 Carrier Frequency: 25 Hz.
 Initial Phase (rad): 0
 Initial Phase (rad): 0
 Input Signal Offset: 0
 Sideband to modulate: upper
 Low Pass Filter Design Method:
 Hilbert transform filter order:100
Butterworth.
 Filter Order: 4.
 Cut off Frequency: 1.3 Hz.

4. Plot message, modulated, and demodulated signals at points A, B, and C,


respectively in time domain using a single scope block.
5. Plot the spectrum of modulated and demodulated signals using Spectrum
Analyzer blocks.

Task 2:
From the spectrum analyzer, find the bandwidth and sketch both the modulating and
modulated signals with their values.

Page3
Exp.4 Wireless Communications Lab

C) In this section an amplitude modulated signal will be generated without using


Simulink blocks for modulators or demodulators. This section of experiment will use
the basic concept of generating the AM signal and reconstructing the original message.

1. Connect the block shown in figure below.

2. Set the parameters of blocks as given below:

Message Signal Generator: Carrier Signal Generator:


 Amplitude: 5 Volt.  Amplitude: 5 Volt.
 Frequency: 1 Hz.  Frequency: 1 KHz.
 Wave Form: Sine.  Wave Form: Sine.

Offset: Low Pass Filter (Transfer Function):
 Constant Value: 0.
 Numerator coefficients:1.
 Denominator coefficients: [1 50]

3. Highlight the blocks are functioning as modulator and demodulator.


4. Plot the modulated and demodulated signals.
5. Calculate the modulation index.
6. Increase the offset magnitude to 1,2 then 3 and plot modulated and demodulated
signals for each step. Calculate the modulation index for each step.

Page4
Exp.4 Wireless Communications Lab

Task 3:
Consider the following:
Input signal: 4 sin 𝜋 𝑡
Carrier signal: cos 60 𝜋 𝑡
LPF: 4 order, cutoff frequency = carrier frequency
Signal offset: 1
Modulate the signals shown above using the DSB-LC and sketch the
frequency response for modulating and modulated signals.

Page5
Exp.5 Wireless Communications Lab

Exp.5
Additive White Gaussian Noise AWGN

Objectives:
The objective of this lab is to simulate noisy channel using Gaussian uniform distribution.
Simulink is used to model the system.

Theory:
Signal to Noise Ratio SNR
Signal-to-noise ratio (abbreviated SNR or S/N) is a measure used in science and engineering that
compares the level of a desired signal to the level of background noise. SNR is defined as the ratio of
signal power to the noise power, often expressed in decibels. A ratio higher than 1:1 (greater than 0
dB) indicates more signal than noise.

or

where P is average power.

 SNR is not actually a ratio but the difference in decibels between the received signal and the
background noise level (noise floor). For example, if a radio (client device) receives a signal of
-75 dBm and the noise floor is measured at -90 dBm, the SNR is 15 dB. Data corruption and
therefore re-transmissions will occur if the received signal is too close to the noise floor.

Bit rate and Baud rate:


Bit rate: How may bits can be sent per second
Baud (symbol) rate: How many times a signal changes per second

Page1
Exp.5 Wireless Communications Lab

Additive white Gaussian noise (AWGN)


It is a basic noise model used in Information theory to mimic the effect of many random
processes that occur in nature. The modifiers denote specific characteristics:
• Additive because it is added to any noise that might be intrinsic to the information
system.
• White refers to the idea that it has uniform power across the frequency band for the
information system. It is an analogy to the color white which has uniform emissions at
all frequencies in the visible spectrum.
• Gaussian because it has a normal distribution in the time domain with an average time
domain value of zero.

Modelling AWGN in Simulink:


The AWGN Channel block adds white Gaussian noise to a real or complex input signal.
When the input signal is real, this block adds real Gaussian noise and produces a real output
signal. When the input signal is complex, this block adds complex Gaussian noise and
produces a complex output signal.
You can specify the variance of the noise generated by the AWGN Channel block using one
of these modes:
• Signal to noise ratio (Eb/No), where the block calculates the variance from these quantities
that you specify in the dialog box:
- Eb/No, the ratio of bit energy to noise power spectral density
- Number of bits per symbol
- Input signal power, the actual power of the symbols at the input of the block
- Symbol period
• Signal to noise ratio (Es/No), where the block calculates the variance from these quantities
that you specify in the dialog box:
- Es/No, the ratio of signal energy to noise power spectral density
- Input signal power, the actual power of the symbols at the input of the block
Page2
Exp.5 Wireless Communications Lab

- Symbol period
• Signal to noise ratio (SNR), where the block calculates the variance from these quantities
that you specify in the dialog box:
- SNR, the ratio of signal power to noise power
- Input signal power, the actual power of the samples at the input of the block

Relationship Among Eb/No, Es/No, and SNR Modes


For uncoded complex input signals, the AWGN Channel block relates Eb/N0, Es/N0, and SNR
according to the following equations:

Es/N0 = (Tsym/Tsamp) · SNR

Es/N0 = Eb/N0 + 10log10(k) in dB

where
Es = Signal energy (Joules)
Eb = Bit energy (Joules)
N0 = Noise power spectral density (Watts/Hz)
Tsym is the Symbol period parameter of the block in Es/No mode
k is the number of information bits per input symbol
Tsamp is the inherited sample time of the block, in seconds

For real signal inputs, the AWGN Channel block relates Es/N0 and SNR according to the
following equation:

Es/N0 = 0.5 (Tsym / TSamp) · SNR

Note that the equation for the real case differs from the corresponding equation for the complex
case by a factor of 2. This is so because the block uses a noise power spectral density of N0/2
Watts/Hz for real input signals, versus N0 Watts/Hz for complex signals.
 In our lab, we will deal with real input signals.

Procedure:
1. Open a new model and add to it each of one AWGN Channel block, one discrete Sine Wave
block, one Scope and two Spectrum Analyzer blocks (found at DSP System Toolbox/Sinks)
2. Apply the discrete sine wave signal to the AWGN channel
3. Set the signal amplitude as 1 volt, frequency as 100 Hz and 1ms as sample time.
4. Set the AWGN channel mode to signal to noise ratio (SNR) and the input signal power to
1 Watt.
5. Plot the signals before and after adding the noise by using:
- The scope (with two inputs) to display signals in time domain
- The spectrum analyzers to display signals in frequency domain
Page3
Exp.5 Wireless Communications Lab

6. Change the SNR of AWGN channel in the range of (-30 to 120) dB in steps of 30 dB.
7. In time and frequency domain, draw the input signal once and the output signal in each step
change.
8. Let the SNR stick at 10 dB and adjust the amplitude of input signal as 1, 5 then 25 and
notice the change in time domain, draw the three output signals simultaneously using
Simulation Data Inspector by recording the output.

Tasks:

1. Apply AWGN on the DSB-LC


2. If the SNR is given as 20 dB, change the mode of AWGN channel to Es/No with setting the
parameters appropriately such that the outputs are identical in both two modes (SNR &
Es/No) in time and frequency domain. Verify your answer by plotting the outputs.

Page4
Exp.6 Wireless Communications Lab

Exp.6
Frequency Division Multiplexing

Objectives:
The goal of this lab is to simulate frequency division multiplexing (FDM) system.

Theory:
FDM is a mode of transmission by which several signals may be send simultaneously
by positioning their spectra such that each signal spectrum can be separated out from all
others by filtering.

In frequency division multiplexing, the available bandwidth of a single physical medium


is subdivided into several independent frequency channels. Independent message
signals are translated into different frequency bands using modulation techniques, which
are combined by a linear summing circuit in the multiplexer, to a composite signal. The
resulting signal is then transmitted along the single channel by electromagnetic means
as shown in Figure 1. Basic approach is to divide the available bandwidth of a single
physical medium into a number of smaller, independent frequency channels. Using
modulation, independent message signals are translated into different frequency bands.
All the modulated signals are combined in a linear summing circuit to form a composite
signal for transmission as shown in Figure 2. The carriers used to modulate the
individual message signals are called sub-carriers, shown as f1, f2, …, fn.

Theory:

Page1
Exp.6 Wireless Communications Lab

At the receiving end, the signal is applied to a bank of band-pass filters, which separates
individual frequency channels. The band pass filter outputs are then demodulated and
distributed to different output channels as shown in Figure 3. If the channels are very
close to one other, it leads to inter-channel cross talk. Channels must be separated by
strips of unused bandwidth to prevent inter-channel cross talk. These unused channels
between each successive channel are known as guard bands. FDM are commonly used
in radio broadcasts and TV networks. Since, the frequency band used for voice
transmission in a telephone network is 4000 Hz, for a particular cable of 48 KHz
bandwidth, in the 70 to 108 KHz range, twelve separate 4 KHz sub channels could be

Page2
Exp.6 Wireless Communications Lab

used for transmitting twelve different messages simultaneously. Each radio and TV
station, in a certain broadcast area, is allotted a specific broadcast frequency, so that
independent channels can be sent simultaneously in different broadcast area. For
example, the AM radio uses 540 to 1600 KHz frequency bands while the FM radio uses
88 to 108 MHz frequency bands.

Procedure:
1. Consider the two following discrete sine wave messages: -
𝑚1(𝑡) = 2 𝑆𝑖𝑛 20 𝜋 𝑡
𝑚2(𝑡) = 2 𝑆𝑖𝑛 40 𝜋 𝑡
2. Modulate the two signals using AM-DSBSC modulator: the first signal with a
subcarrier frequency of 50 Hz and the second signal with 100 Hz.
3. Add the two modulated signals using adder block.
4. Plot the spectrum of the modulated signals for m1(t), m2(t) and added signal.
5. Modulate the signal output from adder block using AM-DSBSC modulator with a
main-carrier frequency of 300 Hz and plot the spectrum of output signal.
Tasks:

1. Calculate the bandwidth of the output in each step in procedure section.


2. Repeat the procedure except using AM-SSB modulator to modulate the two signals
m1(t) and m2(t), and calculate the bandwidth of the output in each step.
3. Compare the results calculated in no. 2 and no.3, and discuss the effects of using
SSB modulators instead of DSB modulators.

Page3
Exp.7 Communications Lab

Exp.7
Frequency Modulation FM

Objectives:
The goal of this lab is to model Frequency modulation and demodulation using Matlab
Simulink. The behavior of the modulated FM signal will be investigated in terms of frequency
deviations for different message baseband signal types.

Theory:
The Frequency modulation is a modulation scheme in which the carrier varies in accordance
with the change in the message baseband signal.

For more theoretical details of the FM generation and demodulation techniques, refer to your
lecture notes of Communication Systems module.

Procedure:

A)
1. Create a new Simulink model to simulate the frequency modulation and demodulation.
2. Use FM Modulator and Demodulator blocks with the following parameters:

FM Modulator FM Demodulator
• Carrier Frequency: 35 Hz • Carrier Frequency: 35 Hz
• Initial phase: 0 • Initial phase: 0
• Frequency Deviation: 10 Hz • Frequency Deviation: 10 Hz
• Hilbert transform filter order: 100

3. Use signal generator to feed the FM modulator with a sinewave message signal with
amplitude of 0.5 and frequency of 5 Hz. The message should be discretized at sampling
rate of 0.002 sec before being fed to the modulator.
4. Use two spectrum analyzers to show the FM modulated and demodulated signals in
frequency domain.
5. Use one scope with four axes to show each of the message, carrier, modulated and
demodulated signals in time domain.
6. Verify the frequency of the message and carrier from the plots.
7. Calculate the number of samples/cycle in the carrier signal by pen and paper, then
verity it from the time domain plot.

Page1
Exp.7 Communications Lab

Task 1: Calculate the frequencies that appear in the modulated signal and verify them from
the spectrum.

B)
1. Change the message signal type to a square wave with amplitude of 0.5 and frequency
of 5 Hz.

Task 2:

2. Keep the rest of model parameters as they are except changing one single parameter to
show the modulated signal with a minimum frequency appears at 20 Hz.
3. Plot all signals in time and frequency domains.

Task 3: How can you make the bandwidth limited to maximum frequency at 40 Hz, select an
appropriate parameter and plot the spectrum.

Page2
Exp.8 Communications Lab

Exp.8
Analogue to Digital Converter ADC

Objectives: The objective of this lab is to


 Understand the mechanism of ADC.
 Identify the aliasing effect and quantization error in speech signals.
 Observe the signals outputs using logging and recording features.

Theory:
A digital system can be implemented as a combination of digital hardware and software,
each of which performs its own set of specified operations.

Pulse-code modulation PCM


PCM is a method used to digitally represent sampled analog signals. It is the standard
form of digital audio in computers, compact discs, digital telephony and other digital
audio applications. In a PCM stream, the amplitude of the analog signal is sampled
regularly at uniform intervals, and each sample is quantized to the nearest value within
a range of digital steps.

Analogue-to-Digital Converter ADC


Most signals of practical interest, such as speech, biological signals, radar signals, sonar
signals and various communications signals such as audio and video signals, are analog.
To process analog signals by digital means, it is first necessary to convert them into
digital form (stream of 0s and 1s). this process is called analog-to-digital (A/D)
conversion, and the corresponding devices are called A/D converters (ADCs). The A/D
conversion is a three-step process that includes: sampling, quantization and encoding.
 Example of application: People often produce music on computers using an analog
recording and therefore need ADCs to create the PCM data streams that go onto
compact discs CD and digital music files.

Page1
Exp.8 Communications Lab

A) Sampling stage

 Clearly we have two sinusoids whose samples are identical and so the ADC will not
be able to distinguish one from the other. What sinusoid do you think will actually
be reconstructed at the DAC from the samples? Why do we call the second example
ALIASING?
 Hence, we apply Nyquist Theorem (fs ≥ 2fmax) to avoid Aliasing.

Page2
Exp.8 Communications Lab

B) The Quantization and Encoding Processes


A signal in the time domain is made discrete in the amplitude domain by the
quantization process. In quantization, the amplitude of the signal is approximated to
standard M quantization levels. These standard levels are encoded to produce digital
signal. Usually M=2n, where n and M are integers & n is the number of bits per sample.
The value of n is called the signal resolution in most applications of DSP.

Page3
Exp.8 Communications Lab

Procedure:
A)
1. Connect the block diagram shown in the figure below.

Figure: Quantization Process

2. The Sampler block in the figure is called Zero-Order-Hold.


3. Set the parameters of the blocks as follow:
Sine wave: (Amplitude = 4 Volt; frequency = 1 Hz)
Sampler: (fs =100 Hz)
Quantizer: (quantization interval = 1)
4. Set the simulation stop time to 1, then run the model.
5. Notice the output signals from the Scope.
6. Compare between the variables AfterQuantiz and BeforeQuantiz in the MATLAB
Workspace.
7. Now set quantization interval to 0.5 (i.e. we double the quantization levels) and notice the
change from the output.

B)
To easily noticing the change in output while changing some parameters, we remove the To
Workspace blocks from the models (as below), then we do signals logging and recording as
follow:

Page4
Exp.8 Communications Lab

Tasks:
1. Model the figure in procedure (A), and set the quantization interval to 0.5. Add
an appropriate block to the model to simulate the quantization error (noise).

2. Model the quantization of (5 Sin 4𝜋) using three levels only, then calculate and
graph the quantization error.

Page5
Exp.9 Communications Systems Lab

Exp.9
Digital Modulation

Objectives:
The goal of this lab is to simulate digital modulation mechanisms namely FSK, ASK
and PSK using Simulink MATLAB.

Theory:
Digital-to-analog conversion is the process of changing one of the characteristics of an
analog signal based on the information in digital data. The figure below shows the
relationship between the digital information, the digital-to-analog modulating process,
and the resultant analog signal.

A sine wave is defined by three characteristics: amplitude, frequency, and phase. When
we vary any one of these characteristics, we create a different version of that wave. So,
by changing one characteristic of a simple electric signal, we can use it to represent
digital data. Any of the three characteristics can be altered in this way, giving us at least
three mechanisms for modulating digital data into an analog signal: amplitude shift
keying (ASK), frequency shift keying (FSK), and phase shift keying (PSK). In
addition, there is a fourth (and better) mechanism that combines changing both the
amplitude and phase, called quadrature amplitude modulation (QAM). QAM is the
most efficient of these options and is the mechanism commonly used today.

Page1
Exp.9 Communications Systems Lab

Data Rate Versus Signal Rate


We can define the data rate (bit rate) and the signal rate (baud rate) as we did for
digital transmission. The relationship between them is

where N is the data rate (bps) and r is the number of data elements carried in one signal
element. The value of r in analog transmission is r = log2 L, where L is the number of
different signal elements. The same nomenclature is used to simplify the comparisons.

An analogy is used to demonstrate the bit rate and baud rate. In transportation, a baud
is analogous to a vehicle, and a bit is analogous to a passenger. We need to maximize
the number of people per car to reduce the traffic.

Example:
An analog signal carries 4 bits per signal element. If 1000 signal elements are sent per
second, find the bit rate.
Solution
In this case, r = 4, S = 1000, and N is unknown. We can find the value of N from

Page2
Exp.9 Communications Systems Lab

ASK
In amplitude shift keying, the amplitude of the carrier signal is varied to create signal
elements. Both frequency and phase remain constant while the amplitude changes.

FSK
In frequency shift keying, the frequency of the carrier signal is varied to represent
data. The frequency of the modulated signal is constant for the duration of one signal
element, but changes for the next signal element if the data element changes. Both
peak amplitude and phase remain constant for all signal elements.

PSK
In phase shift keying, the phase of the carrier is varied to represent two or more different
signal elements. Both peak amplitude and frequency remain constant as the phase
changes. Today, PSK is more common than ASK or FSK. However, QAM, which
combines ASK and PSK, is the dominant method of digital-to-analog modulation.

Page3
Exp.9 Communications Systems Lab

Procedure:
A) ASK

1. Use Simulink to model the system as below to apply ASK modulation scheme.

2. The Sine Wave block represents the carrier signal with (amp.=1; freq.=2Hz; Ts=0.01).
3. The Pulse Generator represents the message digital signal with (amp.=1; period=2sec;
pulse width=50%).
4. Draw the outputs simultaneously (message, carrier, modulated signals).

B) PSK

1. Re-model the system above but now to simulate PSK modulation scheme.
2. Plot the output signals simultaneously.

Page4
Exp.9 Communications Systems Lab

C) FSK

1. Use the model as depicted below to implement FSK mechanism.

2. Sine Wave3 represents the carrier signal with frequency (𝑓𝑐 = 10 𝐻𝑧)
3. In the FSK signal, we have two frequencies:
- 𝑓1 = 𝑓𝑐 + ∆𝑓 (the higher frequency at digital 1)
- 𝑓0 = 𝑓𝑐 − ∆𝑓 (the lower frequency at digital 0)
where 𝑓𝑐 is the carrier frequency, ∆𝑓 is the frequency deviation,
4. Use ∆𝑓 = 4 𝐻𝑧 to be applied to calculate 𝑓1 and 𝑓0, then set them in the Sine Wave1
and Sine Wave2 blocks in the model above.
5. Draw all output signals simultaneously.

Tasks:
1. Compare between ASK, FSK and PSK in terms of bandwidth usage.
2. We used in the lab BPSK. Why is it called so? is there other types of PSK?
compare between them briefly.
3. We implemented PSK in procedure (B) using a digital message as
(10101010....etc.). Reform the message signal to show the PSK output responds
to (1001 1001 1001 ...etc.)
4. We applied FSK in procedure (C) using direct values of 𝑓1 and 𝑓0 set in the blocks.
Now, re-build the model again to implement FSK modulation scheme but using
Product block, i.e. the carrier signal is multiplied by something to produce two
frequencies in the output as FSK signal.

Page5

You might also like