DCT Manual TE-2015 - 05092017

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 22

SSUET/QR/113

LAB CONTENTS

LAB # Date LAB TITLE PAGE # Signature

1 Introduction and Review of MATLAB 2-6

To familiarized with different Types of Pulse Modulation


2 schemes (PAM,PPM and PWM). Write MATLAB programs to 7-9
simulate the modulation process for all types.

3 To familiarized with Pulse Code Modulation. Write MATLAB


10-13
code to understand the fundamentals of PCM

4 To Implement Different Line Coding Schemes using


14-16
MATLAB

5 To find the effect of channel impairmentsand Implementation


17-18
of complex valued Gaussian Noise on Transmitted signal.

To implement detector Using Minimum Distance Decision 19


6

a) Implementation of De-mapping to retrieve decided bits


from decided symbols 20 -21
b) To find Error rate in designed Communication System

9
SSUET/QR/114
Digital Communications (TE331) Lab Manual

10

11

12

13

14

1
DIGITAL COMMUNICATION (TE-331) SSUET/QR/114

LABORATORY EXERCISE 1
OBJECTIVE

Introduction and Review of MATLAB

THEORY

1. Review of MATLAB fundamentals


In this course, we will use software MATLAB. The name MATLAB stands for MATrixLABoratory.
MatLab is a computer program that combines computation and visualization power that makes it
particularly useful for engineers. Originally MATLAB was developed to deal with only one single but
universal data type i.e. the matrix. A matrix is defined by
Its associated name
The number of rows
The number of columns
The value of all matrix elements

The matrix data type includes vectors, for the case when either of the number of rows or the
number of column equals to 1; and it includes scalars when both the number of rows and columns
equal 1. Furthermore, matrices can be either real-valued or complex valued, which is the most
general case.

1.1 Methods used to get Help:


There are several methods in MATLAB to access texts, which explain the usage and behavior of given
functions:
The HELP command is the basic help feature to get help of a function. For example, to get
help on the SUM function, type at the command prompt:
help sum

HELPWIN is used in the same manner as help, but it opens a separate window withadvance
search facilities and links to related topics.

HELPDESK uses a window of an installed web browser to display the help texts.

If the name of a command is not exactly known, the LOOKFOR function helps by seeking
through the first comment line of all available functions and listing all functions where a
desired expression is found.

b) Statement, expressions and variables:


MATLAB is an expression language. The expressions you type are interpreted and evaluated.
MATLAB statements are usually of the form
variable = expression
or simply,
expression
Expressions are usually composed from operators, functions and variable names. Evaluation of the
expression produces a matrix, which is then displayed on the screen and assigned to the variable for
future use.
A statement is normally terminated with the carriage return. However, a statement can be
continued to the next line with three or more periods followed by a carriage return. On the other
hand, several statements can be placed on a single line if separated by commas or semicolon.

1.2 The variable:

2
DIGITAL COMMUNICATION (TE-331) SSUET/QR/114

If the variable name and sign of equality i.e. = are omitted, a variable ANS (stands for answer) is
automatically created to which the result is assigned.

Variable names:
Must start with a letter
May contain only letters, digits, and the underscore _
Matlab is case sensitive, i.e. one &OnE are different variables.
Matlab only recognizes the first 31 characters in a variable name.

1.2.1 Workspace:
The contents of all the variables are stored in the MATLAB workspace. This is the memory region
allocated for variable(s).
The command WHO lists all variable which currently exist in the workspace.
WHOS additionally lists the size and amount of allocated memory along with the variable
names
The entire workspace or single variable can be cleared by using the CLEAR command or by
clc command.

1.2.2 Suppressing screen output:


If the last character of a statement is a semicolon, the printing is suppressed, while the assignment is
carried out. This is essential in suppressing unwanted printing of intermediate results.
1.2.3 Colon notation:
Colon notation is used to generate vectors, and reference sub-matrices known as subscripting.
Creative use of this feature makes MATLAB programming code simple, readable and minimizes the
use of loop, which slows the processing speed of MATLAB.
An index vector is created by using the colon notation as; first : last
For example,
An spacing can be introduced between two elements of a vector by using the colon notation
as; first : spacing : last
For example,
Example of Row vector:
>> X=[1:5] or [1 2 3 4 5] or [1,2,3,4,5] generates row vector X = [1 2 3 4 5] % single row and 5
columns. 1 : 5creates the vector [1 2 3 4 5]
Example of Row vector:
y= [2;4;6;8] generates column vector y = 2 % single column & 4 rows.
4
6
1: 2 : 5creates the vector1 3 5 8

Comment statements are preceded by a "%".

1.3 Defining Matrices


A Matrix array is two-dimensional, having both multiple rows and multiple columns, similar to vector
arrays:
it begins with [, and end with ]
spaces or commas are used to separate elements in a row
Semicolon or enter is used to separate rows.
Example:
>> f= [2 4 7;1 5 3]generates a 2 x 2 metrics f= 2 4 7
1 5 3

1.3.1 Real and complex matrices:


In general, any matrix within the MATLAB can be complex-valued. However, for efficient storage,
MATLAB distinguishes between real-valued and complex-valued matrices. Real valued matrices are

3
DIGITAL COMMUNICATION (TE-331) SSUET/QR/114

matrices where the imaginary parts of all matrix elements are zero. The following essentials must be
known to deal with complex-valued matrices:
The variables i and j are assigned, by default, the value i -1 . This is used to define
the complex values. For example,
5 j *10
generates a complex-valued variable.

The real part of a complex-valued matrix can be extracted by using the function REAL and
imaginary part can be extracted by using the function IMAG. Both functions deliver the real-
valued matrices as outputs.

The function CONJ is used to produce the complex conjugate of a matrix.

The special character generates the complex conjugate transpose of a matrix, the hermitian
matrix. This character is written after an expression or variable.
For example, the hermitian of a matrix A can be obtained through:
A
1.4 Elementary operations on Matrices:
MATLAB contains a number of arithmetic, relational, and logical operations on matrices.
Algebraic expressions can be formed by the following basic operations:
Transpose of a vector/matrix can be produced by: .
For example: B.

+ is used to add two vectors/matrices of identical size, or a vector/matrix and a scalar.For


example:
[1 2;3 4] + [5 6;7 8]

- subtracts two vectors/matrices of identical size, or a vector/matrix and a scalar. For


example:
2B

performs element-wise multiplication of two vectors/matrices of identical size, or a


vector/matrix and a scalar. For example, to square all elements of B, we may write
B.*B

/ performs element-wise division of two vectors/matrices of identical size, or


avector/matrix and a scalar. For example, the reciprocal of all elements in B is computed
through
1./B

performs vector/matrix multiplication. The number of columns in the first vector/matrix


must equal to the number of rows in the second. Example:
B*B

1.4.1 Often Needed Special Matrices:

Some special vectors and matrices are often required:

ONES: Creates a matrix with all entries being equal to 1.


ZEROS:Creates a matrix with all entries 0. This is used frequently to pre-allocate a matrix.
EYE:Creates an identity matrix.

1.4.2 Subscripting Matrix Elements:

4
DIGITAL COMMUNICATION (TE-331) SSUET/QR/114

Parts of matrices can be extracted by subscripting these elements, using braces () to specify the
subscripted elements. MATLAB distinguishes three methods of subscription, here explained for the
example of a matrix B

B(2,3) extracts the value in row 2, column 3


B(1:3,3) extracts the first three elements in column 3
B(2,:) extracts all elements in row 2
B(2,[3 1]) extracts the third and first element in row 2
B([1 3],[2 3]) extracts the four elements in rows 1 and 3,columns 2 and 3

1.5 Logical Expressions:


The following relational operations are dened in MatLab;
< less than
<= less than or equal to
>greater than
>= greater than or equal to
== equal to
~= not equal to
These are element-be-element operations which r eturn a matrix o f o nes( 1 = true) and zeros (0 = false).
Be careful of the distinction between = and ==.

1.6 M-files:
MATLAB can execute a sequence of statements stored in a file. Such files are called M-files because
they have .m extension as the last part of their file name.
There are two types of M-types:
Script files
Function files

1.6.1 Script file:


In a script file, script is a sequence of commands as they could be entered at the prompt. The script
allows to execute the entire sequence multiple times in a comfortable way, or to test modified
versions.

1.6.2 Function file:


In a function file, function has the additional feature of passing parameters. On calling a function, it
may read input arguments and after execution, it may return output values. The FUNCTION
command specifies the input and output parameters of a function. It must be veryfirst command in a
function file. Only comment may be written before the FUNCTION command. Any text after a % sign
inside an m-file is a comment.

5
DIGITAL COMMUNICATION (TE-331) SSUET/QR/114

LAB Task:
Task1:
Try all help methods to get help for any MATLAB Command.

Task2:
Generate a Row Vector A with values from 0 to 9.

Task 3:
Assign a 3x3 Matrix to B by using Magic command.

Task 4:
Assign a 3x3 Matrix to C without printing its output on Screen.

Task 5:
Check what variables you currently have e in workspace. Clear variable C.

Task 6:
Investigate the difference between Matrix Multiplication and Element-wise Multiplication.

Task7:
Explore and use the following Command with suitable example. Ones, Zeros, and eye.

Task 8:
Generate a Matrix C through magic command of size 3then extracts:
i. Elements of 3rd row and 1st column
ii. All elements of 2nd column
iii. All elements of 3rd row
iv. 1st and 2nd elements of column 2
v. 1st and 3rd elements of 2nd and 3rd column

Task 9:
Explore and use the following Command with suitable example. Real, Imag, and Conj.

Task 10:
Generate a complex valued matrix z=ones(1,5)+i(1:5) and calculate the absolute square of each
element.

Task 11:
Explore and use the following Command with suitable example. Plot, semilogy, stem and subplot.

Task 12:
Explain the difference between Script and function file.

6
DIGITAL COMMUNICATION (TE-331) SSUET/QR/114

LABORATORY EXERCISE 2
OBJECTIVE

To familiarized with different Types of Pulse Modulation schemes (PAM,PPM and PWM). Write
MATLAB programs to simulate the modulation process for all types.

THEORY

2. Pulse Modulation:

The process of transmitting signals in the form of pulses (discontinuous signals) by using special
techniques is known as Pulse Modulation. It consists essentially of sampling analog information
signals and then converting those samples into discrete pulses and transporting the pulses from a
source to a destination over a physical transmission medium.

2.1. Types of Pulse Modulation:

Analog Pulse Modulation


Digital Pulse Modulation

2.2. Analog Pulse Modulation:

Pulse AmplitudeModulation (PAM)


Pulse WidthModulation (PWM)
Pulse Position Modulation(PPM)

2.3. Digital Pulse Modulation

Pulse CodeModulation (PCM)


Delta Modulation(DM)

2.2.1. Pulse Amplitude Modulation(PAM)

PAM is a modulation scheme where the message is encoded in the amplitude of a series of amplitude
pulses. Its an analog modulation scheme in which the amplitudes of a train of carrier pulses are
varied according to the amplitude of message signal. In the pulse amplitude modulation, the message
signal is sampled at regular periodic or time intervals and this each sample is made proportional to the
magnitude of the message signal. These sample pulses can be transmitted directly using wired media
or we can use a carrier signal for transmitting through wireless.

Example: A two-bit modulator (PAM-4) will take two bits at a time and will map the signal amplitude
to one of four possible levels, for example 3 volts, 1 volt, 1 volt, and 3 volts. There are two types
of sampling techniques for transmitting messages using pulse amplitude modulation, they are

FLAT TOP PAM: The amplitude of each pulse is


directly proportional to instantaneous modulating
signal amplitude at the time of pulse occurrence and
then keeps the amplitude of the pulse for the rest of
the half cycle.

7
DIGITAL COMMUNICATION (TE-331) SSUET/QR/114

Natural PAM: The amplitude of each pulse is


directly proportional to the instantaneous
modulating signal amplitude at the time of pulse
occurrence and then follows the amplitude of the
modulating signal for the rest of the half cycle.

2.2.2. Pulse Width Modulation (PWM)

It is a type of analog modulation. In pulse width modulation or pulse duration modulation, the width
of the pulse carrier is varied in accordance with the sample values of message signal or modulating
signal or modulating voltage. In pulse width modulation, the amplitude is made constant. We can vary
the pulse width in three ways

By keeping the leading-edge constant and vary the pulse width with respect to leading edge
By keeping the tailing constant.
By keeping the center of the pulse constant.

2.2.3. Pulse Position Modulation (PPM)

In the pulse position modulation, the position of each pulse in a signal by taking the reference signal is
varied according to the sample value of message or modulating signal instantaneously. In the pulse
position modulation, width and amplitude is kept constant.

Fig 2.1 An illustration of Pulse Modulation Schemes

8
DIGITAL COMMUNICATION (TE-331) SSUET/QR/114

Lab Exercise:

Task1: Generate PAM wave form.

Construct a time array from 0 to 1 sec with 0.01 intervals. Name it t.


Find the size of the array t. Use length function. Name the size n.
Construct signal array x. Signal is a sinewave with unity amplitude and unity angular
frequency.
Construct carrier array c. Carrier is a rectangular pulse with 1 amplitude and sampling
frequency 20.
Modulate the signal and carrier for each time interval (for each element of array t). Name it
pam.
Show the output with proper labelled diagrams through subplot command.

Task2: Generate PWM wave form.

Construct a time array from 0 to 1sec with 0.001 intervals. Name it t.


Find the size of the array t. Use length function. Name the size n.
Construct signal array x. Signal is a sinewave with amplitude is 3 and unity angular
frequency.
Construct carrier array c. Carrier is a sawtooth wave signal with 5 amplitude and angular
frequency 5.
Modulate the signal and carrier for each time interval (for each element of array T). Name it
pwm.
Show the output with proper labelled diagrams through subplot command.

Task3: Generate PPM wave form.

Construct a time array from 0 to (2/fm-1/fs) sec with 1/fs intervals. Name it t.
Find the size of the array t. Use length function. Name the size n.
Construct signal array x. Signal is a sinewave with 0.4 amplitude, 0.5 phase shift and 200
angular frequency.
Take carrier frequency 1000 and sampling frequency 10000.
Use MATLAB modulate command to modulate the signal and carrier for PPM.
Show the output with proper labelled diagrams through subplot command.

Task4:

Repeat Task 2 with MATLAB modulate command.

Task5:

Generate square wave, rectangular pulse and sawtooth waveform without using MATLAB built-
in commands.

9
DIGITAL COMMUNICATION (TE-331) SSUET/QR/114

LABORATORY EXERCISE 3
OBJECTIVE

To familiarized with Pulse Code Modulation. Write MATLAB code to understand the fundamentals
of PCM

THEORY

3. Pulse Code Modulation (PCM):

Pulse code modulation is a method that is used to convert an analog signal into a digital signal, so that
modified analog signal can be transmitted through the digital communication network. PCM is in
binary form, so there will be only two possible states high and low (0 and 1). We can also get back
our analog signal by demodulation. The Pulse Code Modulation process is done in three steps
Sampling, Quantization, and Coding.Using PCM, it is possible to digitize all forms of analog data,
including full-motion video, voices, music, telemetry, and virtual reality (VR).

In sampling, we are using PAM sampler that is Pulse Amplitude Modulation Sampler which converts
continuous amplitude signal into Discrete-time- continuous signal (PAM pulses). Basic block diagram
of PCM is given below for better understanding.

Fig 3.1 Block Diagram of PCM Encoder

3.1. Sampling

Sampling is a process of measuring the amplitude of a continuous-time signal at discrete instants,


converts the continuous signal into a discrete signal. For example, conversion of a sound wave to a
sequence of samples. The Sample is a value or set of values at a point in time or it can be spaced.
Sampler extract samples of a continuous signal, it is a subsystem ideal sampler produces samples
which are equivalent to the instantaneous value of the continuous signal at the specified various
points. The Sampling process generates flat- top Pulse Amplitude Modulated (PAM) signal.

10
DIGITAL COMMUNICATION (TE-331) SSUET/QR/114

Fig 3.2 Different types of Sampling

Sampling frequency, Fs is the number of average samples per second also known as Sampling rate.
According to the Nyquist Theorem sampling rate should be at least 2 times the upper cutoff
frequency. Sampling frequency, Fs>=2*fmax to avoid Aliasing Effect. If the sampling frequency is
very higher than the Nyquist rate it become Oversampling, theoretically a bandwidth limited signal
can be reconstructed if sampled at above the Nyquist rate. If the sampling frequency is less than the
Nyquist rate it will become Under sampling. Basically, two types of techniques are used for the
sampling process. Those are 1. Natural Sampling and 2. Flat- top Sampling.

3.2. Quantization

In quantization, an analog sample with an amplitude that converted into a digital sample with an
amplitude that takes one of a specific defined set of quantization values. Quantization is done by
dividing the range of possible values of the analog samples into some different levels, and assigning
the center value of each level to any sample in quantization interval. Quantization approximates the
analog sample values with the nearest quantization values. So almost all the quantized samples will
differ from the original samples by a small amount. That amount is called as quantization error. The
result of this quantization error is we will hear hissing noise when play a random signal. Converting
analog samples into binary numbers that is 0 and 1.

In most of the cases we will use uniform quantizers. Uniform quantization is applicable when the
sample values are in a finite range (Fmin, Fmax). The total data range is divided into 2n levels, let it
be L intervals. They will have an equal length Q. Q is known as Quantization interval or quantization
step size. In uniform quantization, there will be no quantization error.

Fig 3.3 Quantization Process

11
DIGITAL COMMUNICATION (TE-331) SSUET/QR/114

3.3. Encoding

The encoder does the digitization of analog signal. It designates each quantized level by a binary
code. The sampling done here is the sample-and-hold process. Encoding is the process of representing
the sampled values as a binary number in the range 0 to n. The value of n is chosen as a power of 2,
depending on the accuracy required. Increasing n reduces the step size between adjacent quantization
levels and hence reduces the quantization noise. The down side of this is that the amount of digital
data required to represent the analogue signal increases.

Fig 3.4 Encoding Process

12
DIGITAL COMMUNICATION (TE-331) SSUET/QR/114

Lab Exercise:

Task1: Generate cosine wave with unit amplitude and 110 Hz frequency. Perform sampling of
generated signal with following:

o Nyquist rate
o Fs>2fm
o Fs<2fm

Take t=0:0.0005:0.2. Plot analog signal along with its sampled output and explain your observation
for above three conditions.

Task2:Generate cosine wave with unit amplitude and 110 Hz frequency. Perform sampling and
quantization of generated signal with followingMatlab commands:

o Round
o Ceil
o floor

Plot analog signal, sampled output and quantized output. Explain results.

Task3:

By taking number of digits after decimal to be retained from user repeat task 2. Plot analog signal,
sampled output and quantized output. Explain results.

( 10())
=
10()

Task4:

write a program to quantize the signal x(n)=cos(2*pi*f*t)using truncation to 64,128,256 quantization


levels. In each case plot x(n), Xq(n) and Xe(n) and compute corresponding SQNR.

= cos(2 )

log( 1)
=
2

q=digits to be retained
N=sub Intervals
( 10^())
=
10^()


= 10log( )

13
DIGITAL COMMUNICATION (TE-331) SSUET/QR/114

LABORATORY EXERCISE 4
OBJECTIVE

To Implement DifferentLine Coding schemes using MATLAB

THEORY

4. Baseband Transmission:
4.1. Waveform Representation of Binary Digits (Line Coding)

We have studied in lab 4 that how analog waveforms are transformed into binary digits via the use of
PCM. There is nothing "physical" about the digits resulting from this PCM process. Digits are just
abstractions- a way to describe the message information.Thus, we need something physical that will
represent or "carry" the digits. We will represent the binary digits with electrical pulses to transmit
them through a baseband channel. Thus, a sequence of electrical pulses having somecan be used to
transmit the information in the PCM bit stream, and the process is known as line coding.

4.2. PCM Waveform Types (Line Coding Types):

When pulse modulation is applied to a binary symbol, the resulting binary waveform is called a pulse-
code modulation (PCM) waveform. There are several types of PCM waveforms that are described
below, in telephony applications, these waveforms are often called line codes. When pulse modulation
is applied to a nonbinary symbol, the resulting waveform is called an M-arypulse-modulation
waveform. The PCM waveforms fall into the following four groups.

1. Nonreturn-to-zero (NRZ)
2. Return-to-zero (RZ)
3. Phase encoded
4. Multilevel binary

4.2.1. Non Return to Zero (NRZ)

The NRZ group is probably the most commonly used PCM waveform. It can be partitioned into the
following subgroups:

a) NRZ-L (L for level)


b) NRZ-M (M for mark)
c) NRZ-S (S for space)

4.2.1.1. NRZ-L

NRZ-L is used extensively in digital logic circuits.A binary one is represented by one voltage level
and a binary zero is represented by another voltage level. There is a change in level whenever the data
change from a one to a zero or from a zero to a one.

4.2.1.2. NRZ-M

With NRZ-M, the one, or mark, is represented by a change in level, and the zero, or space, is
represented by no change in level. This is often referred to as differential encoding. NRZ-M is used
primarily inmagnetic tape recording.

14
DIGITAL COMMUNICATION (TE-331) SSUET/QR/114

4.2.1.3. NRZ-S

NRZ-S is the complement of NRZ-M: A one is represented by no change in level, and a zero is
represented by a change in level.

4.2.2. Return to Zero (RZ)

The RZ waveforms consist of unipolar-RZ, bipolar-RZ. and RZ-AMI. Thesecodes find application in
baseband data transmission and in magnetic recording. With unipolar-RZ, a one is represented by a
half-bit-wide pulse, and a zero is represented by the absence of a pulse. With bipolar-RZ, the ones and
zeros are represented by opposite-level pulses that are one-half bit wide. There is a pulse present in
each bit interval. RZ-AMI (AMI for "alternate mark inversion") is a signaling scheme used in
telephone systems. The ones are represented by equal-amplitude alternating pulses. The zeros are
represented by the absence of pulses.

Fig 4.1 Different Line Coding Schemes

15
DIGITAL COMMUNICATION (TE-331) SSUET/QR/114

Lab Exercise:

Task1:

Generate Message signal (Binary Data that was output of PCM) by creating a Function
[q]=bitgen(m,n) which generates a matrix A of size m,n with random values with equal probabilities.
Use the MATLAB function RAND, which generates uniformly distributed pseudo random numbers.

Task2:

Generate Noisy signal (Random Complexed valued) by creating a Function [qc]=noisy_data(m,n)


which generates a matrix A of size m,n with random values with equal probabilities. Use the
MATLAB function RANDN, which generates gaussian distributed pseudo random numbers.

Task3:

Write a function [xL]=bit2sym(q,A), Which converts a vector of bits, Q, into a vector X of transmit
symbols, according to the binary transmit symbol alphabet specified by the 2-element vector A = [a0;
a1]by using NRZ-L Line coding scheme. (Hint: Take A= [-1 1] for NRZ-L Scheme and q is the output
of task1).

Task4:

Write a function [xM]=bit2sym(q,A), Which converts a vector of bits, Q, into a vector X of transmit
symbols, according to the binary transmit symbol alphabet specified by the 2-element vector A = [a0;
a1]by using NRZ-M Line coding scheme. (Hint: Take A= [-1 1] for NRZ-M Scheme and q is the
output of task1).

Task5:

Write a function [xS]=bit2sym(q,A), Which converts a vector of bits, Q, into a vector X of transmit
symbols, according to the binary transmit symbol alphabet specified by the 2-element vector A = [a0;
a1]by using NRZ-S Line coding scheme. (Hint: Take A= [-1 1] for NRZ-S Scheme and q is the output
of task1).

16
DIGITAL COMMUNICATION (TE-331) SSUET/QR/114

LABORATORY EXERCISE 5
OBJECTIVE

To find the effect of channelimpaimentsand Implementation of complex valued Gaussian Noise on


Transmitted signal.

THEORY

5.1 Channel Impairments

In the case of baseband signaling, the received waveforms are already in a pulse like form. One might
ask, why the n, is a demodulator needed to recover the pulse waveforms? The answer is that the
arriving baseband pulses are not in the form of ideal pulse shapes hence There are two primary causes
for error-performance degradation. The first is the effect of filtering at the transmitter, channel, and
receiver. Another cause for error-performance degradation is electrical noise and interference
produced by a variety of sources, such as galaxy and atmospheric noise, switching transients,
intermodulation noise, as well as interfering signals from other sources.

With proper precautions, much of the noise and interference entering a receiver can be reduced in
intensity or even eliminated. However, there is one noise source that cannot be eliminated, and that is
the noise caused by the thermal motion of electrons in any conducting media. This motion produces
thermal noise in amplifiers and circuits, and corrupts the signal in an additive fashion.The primary
statistical characteristic of thermal noise is that the noise amplitudes are distributed according to a
normal or Gaussian distribution,

5.2 Gaussian Noise

The task of the detector is to retrieve the bit stream from the received waveform,as error free as
possible, notwithstanding the impairments to which the signal mayhave been subjected. There are two
primary causes for error-performance degradation.The first is the effect of filtering at the transmitter,
channel, and receiver.

Another cause for error-performance degradation is electrical noise and interference produced by a
variety of sources, such as galaxy and atmospheric noise, switching transients, intermodulation noise,
as well as interfering signals from other sources.With proper precautions, much of the noise and
interference entering a receiver can be reduced in intensity or even eliminated. However, there is one
noise source that cannot be eliminated, and that is the noise caused by the thermal motion of electrons
in any conducting media. This motion produces thermal noise in amplifiers and circuits, and corrupts
the signal in an additive fashion.

The primary statistical characteristic of thermal noise is that the noise amplitudes are distributed
according to a normal or Gaussian distribution.The primary spectral characteristic of thermal noise in
communication systems, is that its two-sided power spectral density is flat for all frequencies of
interest. In other words, the thermal noise, on the average, has just as much power per hertz in low-
frequency fluctuations as in high-frequency fluctuations-up to a frequency of about 10 12 hertz. When
such a constant-power spectral density characterizes the noise power, we refer to it as white noise.
Since thermal noise is present in all communication systems and is the predominant noise source for
many systems, the thermal noise characteristics (additive, white, and Gaussian. giving rise to the
name A WGN are most often used to model the noise in the detection process and in the design of
receivers. Whenever a channel is designated as an A WGN channel (with no other impairments
specified), we are in effect being told that its impairments are limited to the degradation caused by
this unavoidable thermal noise.

17
DIGITAL COMMUNICATION (TE-331) SSUET/QR/114

LAB EXERCISES:
Task1:

Use MATLAB command conv to find the effect of channel on transmitted information by performing
convolution of input signal with ideal channel impulse response.

Write a function [v]=chanres(x,h) where x is the transmitted symbols and h is the channel response.
Plot the output signal using STEM command.

Task2:

Investigate how above function works by passing a step function:

through a filter with the impulse response

Display all signals using the STEM function. Which part of the output signal must be out to obtain a
time alignment of input and output signals?

Task3:

Real-valued Gaussian noise can be produced using the built-in MATLAB function RANDN. This
produces pseudo-random numbers following a zero-mean Gaussian distribution with variance 1.

Write a function [D]=RANDNCP(M,N) which delivers an M x N matrix D of complex-valued


Gaussian noise with variance 1 in both real and imaginary parts. Test the function by producing a
SCATDIAGplot of delivered values.

Task4

Generate Received signal by adding noise into signal coming from the channel (v). Test the function
by producing a SCATDIAGplot of transmitted and received symbols.

18
DIGITAL COMMUNICATION (TE-331) SSUET/QR/114

LABORATORY EXERCISE 6
OBJECTIVE

To implement detector Using Minimum Distance Decision

THEORY

During a, given signaling interval T, a binary baseband system will transmit one oftwo waveforms,
denoted g1(t) and git). Similarly, a binary bandpass system willtransmit one of two waveforms,
denoted s1(t) and s2(r). Since the general treatment of demodulation and detection are essentially the
same for baseband and bandpasssystems, we use s;(t) here as a gene ric designation for a transmitted
waveform,whether the system is baseband or bandpass. This allows much of the
basebanddemodulation/detection.

LAB EXERCISES:
Task1:
Implement a function
[XH,ID]=DECMIND(Y,A)
which performs minimum-distance decision on the complex-valued received symbols given in
vector Y, according to the binary transmit symbol alphabet A=[a0; a1]. Compute squared
Euclidean distances, then use the function MIN to find the minimum distances. The decided
symbols corresponding with vector Y are returned in vector XH, and ID contains the indices of
decided symbols within the transmit symbol alphabet. Example:

Test if decisions are correct by using defined input values and checking the delivered output
values. The SCATDIAG plot will be helpful here.

Task2:
Implement a system using function files to generate data. Pass this data from an AWGN channel and
then introduce it to detector based on Minimum Distance Decision. Test if correct decisions are made
by comparing generated and detected data values.

19
DIGITAL COMMUNICATION (TE-331) SSUET/QR/114

LABORATORY EXERCISE 7
OBJECTIVE

c) Implementation of De-mapping to retrieve decided bits from decided symbols


d) To find Error rate in designed Communication System

THEORY:

a) De-mapping of retrieved symbols to bits is solved most conveniently by using the index of a
decided symbol, instead of the symbol itself.

b) BER:The effects of error-performance degradation in digital communications can be


partitioned into two categories. The first is due to a decrease in received signal power or an
increase in noise or interference power, giving rise to a loss in signalto- noise ratio or Eb/N0 .
The second is due to signal distortion, such as might be caused by intersymbol interference
(lSI). Let us demonstrate how different are the effects of these two degradation types.

Suppose that we require a communication system with a bit-error probabilityPb versus Eb/N0
characteristic corresponding to the solid-line curve plotted in Figure Suppose that after the system is
configured and measurements are taken,we find, to our disappointmen t, that the performance does
not follow the theoretical curve, but in fact follows the dashed line plot. A loss in Eb/N0 bas come
about because of some losses or an increased level of noise or interference.

Figure 7.1 (a) Loss in EJN0. (b) Irreducible P8 caused by distortion.

LAB EXERCISES
Task 1

For binary transmit symbol alphabets, write a function

[QH]=ID2BIT(ID)

Which converts a vector of decided symbol indices, ID, into the corresponding vector of decided bits,
QH. Note that this task is a trivial one for the simple case of a binary transmission.

20
DIGITAL COMMUNICATION (TE-331) SSUET/QR/114

Task 2
Write a function
[R]=ERRATE(S,SH)
Which calculates the error rate R for a vector of transmitted symbols, S, and a vector of received
symbols, SH, of identical sizes. The error rate is the fraction of erroneous values, i.e., unequal values
when comparing S with SH. Write the function such that it can be used for both bit error and symbol
error rate computations.

21

You might also like