Вы находитесь на странице: 1из 14

Executive Summary

This Wireless and Mobile Communication Systems laboratory workbook covers those practicals
that are very knowledgeable and quite beneficial in grasping the core objective of the subject.
These practical solidify the theoretical and practical concepts that are very essential for the
engineering students. This work book comprise of practical covering on the topics of wireless
and mobile communication systems that are designed to develop on Matlab software. Above all
this workbook contains a relevant documentation of the laboratory sessions.

Laboratory 1
Simulation of Wireless Communication Systems

Objective of the Laboratory


The objective of this laboratory is to understand the various digital modulation techniques and
observe the related modulation quality measurements. As we progress, the students will be
familiar with the following basic concepts.

Random data or information generators

Various modulation Types.


Understanding power, spectral efficiency, and data rate trade offs.

Comparison of various modulation types in terms of time envelope, spectral efficiency,


constellation and eye diagrams.

The tradeoff between higher data rates and higher susceptibility to noise at higher orders of
modulation (like 64QAM).

Impact of AWGN and Fading channel on modulation techniques.

Analysis of the bit error rate (BER) of a simple communication system

System Model of Simple Digital Communication Systems


The basic block diagram of a simple digital communication system is shown in the figure below.
In this laboratory, we will study the function of each block and then the performance of the over
all systems through consequent steps. This used to understand the basic principle of a general
digital communication system.

Figure 1: General block diagram of a simple communication system

1. Random Data Generation


1.1 Binary Random Data generator
Every communication system has one or more signal sources. This Lab describes how to use the
Communications Toolbox to generate random signals, which are useful for simulating signal sources.

The conventional format for representing a signal in MATLAB is a vector or matrix.


This example uses the randint function to create a column vector that lists the successive values
of a binary data stream. The length of the binary data stream (that is, the number of rows in the
column vector) is arbitrarily set to 3,000. Then the code plots the histogram and the stem
functions for the data. But for the stem case, we use only the first 50 bits.
Function Used

randint();
stem();
hist();

Questions:

Generate the binary data stream as a column vector of length 3,000.

Show and record the histogram plot of the data

Generate and record the stem plot for the first 50 bits

1.2 White Gaussian Noise Generation


The wgn function generates random matrices using a white Gaussian noise distribution. We
specify the power of the noise either in dBW (decibels relative to a watt), dBm, or linear units.
We can generate either real or complex noise. For example, the command below generates a
column vector of length 50 containing real white Gaussian noise whose power is 2 dBW. The
function assumes that the load impedance is 1 ohm.
y1 = wgn(50,1,2);
To send a signal through an additive white Gaussian noise channel, we use the awgn function.
Questions

Generate a 5-by-4 matrix containing random integers between 0 and 10.

Generate complex white Gaussian noise whose power is 2 watts, across a load of 60 ohms.

2. Digital Modulation of the Random Data


In most media for communication, only a fixed range of frequencies is available for transmission.
One way to communicate a message signal whose frequency spectrum does not fall within that
fixed frequency range, or one that is otherwise unsuitable for the channel, is to alter a
transmittable signal according to the information in your message signal. This alteration is called
modulation and it is the modulated signal that you transmit. The receiver then recovers the
original signal through a process called demodulation.
Modulation Techniques
The methods of modulation depend on whether the input signal is analog or digital. The tables
below show the modulation techniques that Communication Toolbox software supports for
analog and digital signals respectively.

Table 1: Analog modulation methods and their syntaxes

Table 2: Digital modulation techniques and their syntaxes

Modulation Terminology
Modulation is a process by which a carrier signal is altered according to information in a message
signal. The frequency of the carrier signal is usually much greater than the highest frequency of
the input message signal. The Nyquist sampling theorem requires that the simulation sampling
rate, fs, should be greater than two times the sum of the carrier frequency and the highest
frequency of the modulated signal in order for the demodulator to recover the message correctly.
Modulating a Signal
The basic procedure for modulating a signal with MPSK and MQAM involves these steps:
1 Construct a modulator object depending on your modulation type.
2 Adjust properties of the modulator object, if necessary, to tailor it to your needs. For example,
you can change the phase offset or symbol order.
5

3 Modulate your signal by applying the modulate method of the modulator object, as described in
the following section.
Modem Modulation Method
Modulator objects have a method modulate that is used to modulate signals. The syntax is y =
modulate (h, x), where h is the handle to a modulator object and x is a signal. When mapping
input bits to symbols, the first bit is interpreted as the most significant bit. For h.inputtype = `bit'
(i.e., x represents binary input), nBits consecutive elements in each channel or column represent a
symbol, where nBits =log2(M). For h.inputtype = `integer' (i.e., x represents symbol input),
elements of x must be in the range [0, M-1].
Demodulating a Signal
The basic procedure for demodulating a signal with MPSK and MQAM involves these steps:
1 Construct a demodulator object depending on your modulation type.
2 Adjust properties of the demodulator object, if necessary, to tailor it to your needs. For
example, you can change the phase offset or symbol order.
3 Demodulate your signal by applying the demodulate method of the demodulator object, as
described in the following section.
Modem Demodulation Method
Demodulator objects have a method demodulate that is used to demodulate signals. The syntax is
y = demodulate (h, x), where h is the handle to a demodulator object and x is a signal. This
syntax processes the binary words (bits) or symbols (integers) in signal x with the PSK or QAM
demodulator object and output the baseband signal y. The demodulator objects property
DecisionType should be set depending on whether you want hard or soft decisions. To allow for
soft decisions, the demodulator objects property OutputType must be set to 'bit'.
In the next section we will see the principle of QAM modulation. Similar analysis is done for
PSK modulations.

Quadrature Amplitude Modulation (QAM)


Modulate Using M-QAM: having defined xsym as a column vector containing integers between
0 and M, you can use the modulate method of the qammod object to modulate xsym using the
baseband representation.
M is the alphabet size and must be an integer power of two. The message signal must consist of
integers between 0 and M-1. Therefore, if the random source is in binary, we must preprocess the
binary data stream x before using the modulate method of the object. In particular, you arrange
each tuple of values from x across a row of a matrix, using the reshape function in MATLAB,
and then apply the bi2de function to convert each k-tuple to a corresponding integer. (The .'
characters after the reshape command form the un conjugated array transpose operator in
MATLAB. For example use the following command to map the binary data in to corresponding
symbols for the binary generated data in section one.
% Bit to Symbol Mapping
% Convert the bits in x into k-bit symbols.
xsym = bi2de(reshape(x, k, length(x)/k).','left-msb');
% Stem Plot of Symbols
% Plot first 10 symbols in a stem plot.
Figure ; % Creates new figure window.
stem(xsym(1:10));
title('Random Symbols');
xlabel('Symbol Index');
ylabel('Integer Value');

Generally we use the modulation object that we have shown in the tables above to modulate the
signal. In this case, we can change the property of the modulation parameters according to our
design specifications.
QAM Modulator (QAMMOD)
H = modem.qammod (M) constructs a QAM modulator object H for M-ary modulation.
H = modem.qammod (property1, value1, ...) constructs a QAM modulator object H with
properties as specified by property/value pairs.
7

The properties that are unique to the QAM modulator object are set to default values. A QAM
modulator object has the following properties. All the properties are writable except for the ones
explicitly noted otherwise.
Type - Type of modulation object ('QAM Modulator'). This property is not
writable. M - M-ary value.
PhaseOffset - Phase offset of ideal signal constellation in radians.
Constellation- Ideal signal constellation. This property is not writable and is automatically
computed based on M and PhaseOffset properties.
SymbolOrder- Type of mapping employed for mapping symbols to ideal constellation points.
The choices are:

'binary' - for Binary mapping

'gray' - for Gray mapping

'user-defined' - for custom mapping

SymbolMapping - Symbol mapping is a list of integer values from 0 to M-1 that correspond to
ideal constellation points. This property is writable only when SymbolOrder is
set to 'user-defined'; otherwise it is automatically computed.
InputType - Type of input to be processed by QAM modulator object. The choices are:

'bit' - for bit/binary input

'integer' - for integer/symbol input

For instance the syntax H = MODEM.QAMMOD constructs a QAM modulator object H with
default properties. It constructs a modulator object for 16-QAM modulation and is equivalent
to: H = modem.qammod ('M', 16, 'phaseoffset', 0, 'symbolorder', 'binary', 'InputType', 'integer')

Example:
% Construct an object to modulate binary data using 64-QAM modulation.
% The constellation has Gray mapping.
h = modem.qammod('M', 64, 'SymbolOrder', 'Gray', 'InputType', 'Bit')

Gray Mapping the Modulated Signal


Gray mapping is a modulation technique in which the corresponding adjacent bits sequences are
differ by one bit. This mapping technique is used to reduce the probability of BER in the
communication system. For the PSK, DPSK, FSK, QAM, and PAM modulation types, Gray
constellations are obtained by selecting the Gray parameter in the corresponding modulation
function or method. For modulation objects, you can set the symbol order property to Gray to
obtain Gray-encoded modulation.
Questions:
Now based on the above parameters

Modulate the random data that you generate in section one.

Generate the scatter plot of the modulated signal.

Annotate the plot to indicate the mapping

3 Adding the effect of the Additive Gaussian (AWGN) Effects


An AWGN channel adds white Gaussian noise to the signal that passes through it. To model an
AWGN channel, use the awgn function. The relative power of noise in an AWGN channel is
typically described by quantities such as
Signal-to-noise ratio (SNR) per sample. This is the actual input parameter to the awgn function.
Ratio of bit energy to noise power spectral density (Eb/N0). This quantity is used by BERTool
and performance evaluation functions in this toolbox.
Ratio of symbol energy to noise power spectral density (Es/N0)
The relationship between Es/N0 and Eb/N0, both expressed in dB, is as follows:
Es / N0 (dB) = Eb / N0 (dB) + 10log10 (k)
where k is the number of information bits per symbol. In a communication system, k might be
influenced by the size of the modulation alphabet or the code rate of an error-control code. For
example, if a system uses a rate-1/2 code and 8-PSK modulation, then the number of information
bits per symbol (k) is the product of the code rate and the number of coded bits per modulated
symbol: (1/2) log2(8) = 3/2. In such a system, three information bits correspond to six coded bits,
which in turn correspond to two 8-PSK symbols.
The relationship between Es/N0 and SNR, both expressed in dB, is as follows:
Es / N0 (dB) = 10log10 (Tsym / Tsamp ) + SNR (dB) , for complex input signals
9

Es / N0 (dB) = 10log10 (0.5Tsym / Tsamp ) + SNR (dB) , for real input signals
where Tsym is the signals symbol period and Tsamp is the signals sampling period. For
example, if a complex baseband signal is oversampled by a factor of 4, then Es/N0 exceeds the
corresponding SNR by 10 log10(4).
Eye Diagram Plots
An eye diagram is a simple and convenient tool for studying the effects of intersymbol
interference and other channel impairments in digital transmission. To construct an eye diagram,
plot the received signal against time on a fixed time interval axis. At the end of the fixed time
interval, wrap around to the beginning of the time axis. The resulting diagram consists of many
overlapping curves.
Questions

Added an AWGN with SNR of 10 on the modulated signal of section two.

Plot the scatter plot of the modulated and noisy signal

Plot the eye diagram of the modulated and noisy signal

Demodulate the signal and compute the BER of the system

10

Pseudo Code for the whole System


%% Define the input parameters
M = 16;

% Size of signal constellation

k = log2(M);

% Number of bits per symbol

n = 3e4;

% Number of bits to process

nsamp=1

% Oversampling rate

%----------------------------------------------------------------------------------------------------------%% Generate the random data using the signal source


% Create a binary data stream as a column vector and plot the first
% 50 bits in a stem plot.
x = randint(n,1);

% Random binary data stream

figure(1)
stem(x(1:40),'filled');
title('Random Bits');
xlabel('Bit Index');
ylabel('Binary Value');
%-------------------------------------------------------------------------------------------------------------%% Binary Bit to Symbol Mapping
% Used to convert the bits in x into k-bit symbols.
% Reshape(x,m,n) returns the m-by-n matrix whose elements are taken column wise from x.
% An error results if X does not have M*N elements.
xsym = bi2de(reshape(x,k,length(x)/k).','left-msb');
11

% Plot first 10 symbols in a stem plot.


figure(2); % Create new figure window.
stem(xsym(1:50));
title('Random Symbols');
xlabel('Symbol Index');
ylabel('Integer Value');
grid on;

%------------------------------------------------------------------------------------------------%% Modulate the symbols


% Modulate using 16-QAM.
hmod=modem.qammod(M);
y = modulate(hmod,xsym);
figure(3)

plot(y);
xlabel('Inphase component');
ylabel('Quadrature component');
title ('Modulated signal');

%--------------------------------------------------------------------------------------------------%% The equivalent transmit


signal ytx = y;
figure(6)
eyediagram(ytx,8);
%----------------------------------------------------------------------------------------%% Adding the AWGN Channel effects
% Send signal over an AWGN channel.
EbNo = 10; % In dB
snr = EbNo + 10*log10(k) - 10*log10(nsamp);
ynoisy = awgn(ytx,snr,'measured');

%--------------------------------------------------------------------------------------------%% The received signal


yrx = ynoisy;
12

figure(7)
eyediagram(yrx,8);
%-----------------------------------------------------------------------------%% Scatter Plot of the original and noisy signal
% Create scatter plot of noisy signal and transmitted
% signal on the same axes.
figure(4)
h = scatterplot(yrx(1:nsamp*5e3),nsamp,0,'g.');
hold on;
scatterplot(ytx(1:5e3),1,0,'k*',h);
title('Received Signal');
legend('Received Signal','Signal Constellation');
axis([-5 5 -5 5]); % Set axis ranges.
hold off;
%-----------------------------------------------------------------------------------------%% Demodulation of the received signal
% Demodulate the signal using 16-QAM.
zsym = demodulate(modem.qamdemod(M),yrx);
%-------------------------------------------------------------------------------------------%% Symbol-to-Bit Mapping
% Undo

the

bit-to-symbol

mapping

performed

earlier. z = de2bi(zsym,'left-msb');
% Convert integers to bits.
% Convert z from a matrix to a vector.
z = reshape(z.',prod(size(z)),1);
%---------------------------------------------------------------------------------------%% Compute the BER the system
% Compare x and z to obtain the number of errors and
% the bit error rate.
[number_of_errors,bit_error_rate] = biterr(x,z);
% end of the program
%---------------------------------------------------------------------------------------------------------13

Pseudo Code for the Questions


1. Random data generator
% random data generation by using Matlab
% Create a binary data stream as a column vector with length
3,000; N=3,000;
x = randint(N,1); % Random binary data stream
% See the histogram plot of the
data hist(x)
% Plot first 50 bits in a stem plot.
stem(x(1:50),'filled');
title('Random Bits');
xlabel('Bit Index');
ylabel('Binary Value');

14

Вам также может понравиться