Sie sind auf Seite 1von 5

Lab 3 Communication Systems Simulation Using MATLAB

IL2216 Media and Communication Electronics

In this lab, we learn how to model and simulate a typical communications system
using MATLAB. MATLAB is an interactive system for doing numerical
computations. It is widely used in the simulation of communications systems.

1. Before the Start


Please install MATLAB on your laptop. The following link provides detailed
instructions on how to obtain and install the software.
http://www.kth.se/en/student/support/itsc/progdist/software-for-windows/matlab2012a-2012b-1.327659
For those students who are new users, to get started with MATLAB, you may want
to watch the following short videos and examples.
http://www.mathworks.se/videos/getting-started-with-matlab-68985.html
http://www.mathworks.se/products/matlab/examples.html#

2. Modeling and Simulation of a Typical Communications System


A typical communications system is comprised of three parts: modulation at the
transmitter side, transmission over certain channel, and demodulation at the
receiver side, as shown in Fig. 1. In the following, we will explain each part in
detail, and an example will be given to show how each step is implemented in
MATLAB.
2.1 Generate Random Databits

Noise

tx_databits

Modulation

Channel

Demodulation

rx_databits

Fig. 1. Block diagram of a typical communications system.

We model the data information as a stream of random binary bits. The occurrence
of 0 and 1 are of equal probability. Assume a data stream of length 1000, it can
be generated in MATLAB as shown below:
tx_databits = randint(1,1000);
The function randint(m,n) generates an m-by-n binary matrix, each of whose
entries independently takes the value 0 or 1 with probability 1/2.
2.2 Modulation
The above digital bit stream cannot be transmitted directly. Instead, we have to
convey the digital bit stream inside a carrier signal that can be physically
transmitted. Typically a high-frequency sinusoidal waveform is used as the carrier
signal. The process of altering one or more properties (e.g., amplitude, frequency,
and phase) of the carrier signal according to the digital bit stream is called
modulation.
2.2.1 Amplitude Shift Keying (ASK) Modulation
In this modulation scheme, the amplitude of the carrier signal is varied to represent
bit 1 and 0, while the frequency and phase remain the same. One example of the
ASK modulated signal is shown in Fig. 2 (a). It can be implemented in MATLAB
as given below:
s_carrier=sin(2*pi*f1*t);
E1=sum(s_carrier.^2);
s1=s_carrier/sqrt(E1);
s0=0*s_carrier;

% the carrier signal


% bit 1 with normalized energy
% bit 0

2.2.2 Frequency Shift Keying (FSK) Modulation

(a)

(b)

(c)

Fig. 2. Signals with (a) ASK modulation, (b) FSK modulation, and (c) BPSK modulation.

In FSK modulation, the frequency of the carrier signal is altered according to the
bit stream, while the amplitude and phase remain unchanged, as shown in Fig. 2 (b).
2.2.3 Phase Shift Keying (PSK) Modulation
In this modulation scheme, the phase of the carrier changes between different
phases determined by the input bit stream. Here we consider the Binary Phase Shift
Keying (BPSK) modulation where only two different phases are used. A bit 1
produces no phase change and a bit 0 produces a 180 phase shift. One example of
the BPSK modulated signal is shown in Fig. 2 (c).
2.3 AWGN Channel
In this lab, we consider the Additive White Gaussian Noise (AWGN) channel,
which is simply modeled by adding white Gaussian noise to the modulated signal.
The noise power is determined by the transmitted signal power and the predefined
Signal-to-Noise Ratio (SNR). In MATLAB, it can be implemented using the awgn
function as shown below:
y=awgn(x,snr);
This function adds white Gaussian noise to the vector signal x and yields y. The
scalar snr specifies the signal-to-noise ratio in dB. This syntax assumes that the
power of x is 0 dBW.
2.4 Demodulation
Demodulation is the process of extracting the original bit stream from a modulated
carrier signal. In the following, we take the ASK demodulation for example to
show how it is implemented in MATLAB.

s_carrier=sin(2*pi*f1*t);
E1=sum(s_carrier.^2);
s_carrier=s_carrier/sqrt(E1);
s_ask(i)=tx_bit(i)*s_carrier;

% the carrier signal

% unit energy
% ASK modulated signal, tx_bit(i) denotes the
i-th transmitted bit data
s_ask_n(i)=awgn(s_ask(i),snr); % add noise to the modulated signal. Note that
usually this awgn function is applied to the
whole bit stream rather than bit by bit. Here
we adopt this way for simplicity in explanation.
if sum(s_carrier.*s_ask_n(i))>0.5 % ASK demodulation.
rx_bit(i)=1;
else
rx_bit(i)=0;
end
2.5 BER Simulation
The Bit Error Rate (BER) is defined as
.
Each BER is corresponding to a certain SNR value. Usually the BER simulation is
looped over different SNRs. And after the simulation, a vector of BER is obtained
with respect to the previously defined SNR vector. The BER curves are usually
plotted in logarithmic scale by using the semilogy function.

3. Tasks
1) Modeling a digital communications system with ASK, FSK and BPSK
modulation, respectively. Define the system parameters yourself, e.g., the carrier
frequency, the number of transmitted bits, the SNR range.
2) Plot the transmitted digital bit stream, the transmitted signal with ASK
modulation, the transmitted signal with FSK modulation, and the transmitted signal
with BPSK modulation. To increase the visibility, just plot a section of the
generated signal, for example, the first 10 bits.
3) Plot the received ASK, FSK and BPSK signal, respectively.

4) Plot the BER curves versus SNR. The BER curves of the ASK, FSK and BPSK
system should be plotted on the same figure.
5) Find out under what kind of SNR circumstances, the communications system
you have modeled can achieve
BER.

Das könnte Ihnen auch gefallen