0% found this document useful (0 votes)
10 views

Modeling and communication systems

Uploaded by

smart.nb986
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Modeling and communication systems

Uploaded by

smart.nb986
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Gillgamesh Ahliya Department of

University engineering

(Ahmed Hussein Ali)


(Muqtada Sattar Raheem)
(Abbas Ali Abbas)
(Alaa Miri Abd)

2024/11/21
Modeling and communication systems
involve simulating and analyzing the
transmission and reception of signals,
which are fundamental in
communications engineering. MATLAB
is a powerful tool for modeling such
systems due to its rich library of
functions for signal processing,
communication system design, and
visualization.
1. Basics of Communication Systems

A communication system consists of several


components:
• Transmitter: Encodes the message into a
signal suitable for transmission.
• Channel: The medium through which the
signal is transmitted. This can add noise and
distort the signal.
• Receiver: Decodes the received signal back
into the original message.
2. Common Communication Models
Communication systems can be analog (e.g., AM, FM) or
digital (e.g., ASK, PSK, QAM). Let’s focus on digital
communication for this explanation.

Steps in Digital Communication:

1. Source Encoding: Convert data (e.g., text or images)


into binary form.
2. Modulation: Map binary data into signal waveforms for
transmission.
3. Channel Modeling: Simulate real-world impairments
like noise, fading, and interference.
4. Demodulation and Decoding: Recover the transmitted
data.
3. MATLAB Implementation

Step 1: Generate a Random Data Sequence

Generate a binary sequence (e.g., 0s and 1s) to simulate


transmitted data.

data = randi([0 1], 1, 1000); % Generate 1000


random bits
disp(data); % Display the binary sequence

Step 2: Modulation

Use digital modulation techniques to encode the data. For


example, Binary Phase Shift Keying (BPSK):
% BPSK Modulation
modulatedSignal = 2*data - 1; % Map 0->-1 and
1->1
disp(modulatedSignal);

Step 3: Channel Simulation

Add noise to simulate the effect of a real channel. Use the


Additive White Gaussian Noise (AWGN) model:

% Add AWGN to the signal


SNR = 10; % Signal-to-Noise Ratio in dB
receivedSignal = awgn(modulatedSignal, SNR,
'measured');
Step 4: Demodulation
Recover the transmitted bits by demodulating the received
signal:
% BPSK Demodulation
demodulatedData = receivedSignal > 0; % Decision
rule: >0 maps to 1, else 0
disp(demodulatedData);
Step 5: Performance Analysis
Compare the transmitted and received data to calculate the
Bit Error Rate (BER):
% BER Calculation
numErrors = sum(data ~= demodulatedData); %
Count errors
BER = numErrors / length(data); % Bit Error Rate
disp(['Bit Error Rate: ', num2str(BER)]);
4. Visualization
MATLAB provides powerful plotting tools to visualize
signals at different stages.
• Transmit Signal:
figure;
stem(modulatedSignal(1:50), 'filled');
title('Modulated Signal');
xlabel('Sample Index');
ylabel('Amplitude');
• Received Signal:
figure;
plot(receivedSignal(1:50));
title('Received Signal');
xlabel('Sample Index');
ylabel('Amplitude');
• Constellation Diagram (for more complex modulations
like QAM):
scatterplot(receivedSignal);
title('Constellation Diagram');

5. Advanced Topics

• Channel Modeling: Simulate fading channels (e.g.,


Rayleigh or Rician).
• OFDM Systems: Implement Orthogonal Frequency
Division Multiplexing for high data rate systems.
• Error Correction: Use coding schemes like Hamming or
LDPC codes to improve reliability.
• MIMO Systems: Model multiple antennas for capacity
enhancement.
Here’s an example of modeling a Rayleigh fading channel:
% Rayleigh Fading Channel
chan = comm.RayleighChannel('SampleRate', 1e6,
'MaximumDopplerShift', 100);
fadedSignal = chan(modulatedSignal.');
receivedSignal = awgn(fadedSignal, SNR,
'measured');

6. Toolboxes for Communication Systems

MATLAB provides several specialized toolboxes:


• Communications Toolbox: For modulation, demodulation,
and channel modeling.
• Signal Processing Toolbox: For filtering and spectral
analysis.
Let’s dive deeper into advanced modeling of
communication systems with a focus on Orthogonal
Frequency Division Multiplexing (OFDM) and Multiple-
Input Multiple-Output (MIMO) systems. These techniques
are essential in modern communication standards like Wi-
Fi, LTE, and 5G.
1. Orthogonal Frequency Division Multiplexing (OFDM)

OFDM is a multicarrier modulation technique where data


is transmitted over multiple orthogonal subcarriers. It
improves bandwidth efficiency and resilience to
multipath fading.

Key Steps in OFDM Implementation:

1. Serial-to-Parallel Conversion: Split the data into


multiple subcarriers.
2. Modulation: Use a digital modulation scheme (e.g.,
QAM or PSK) for each subcarrier.
3. Inverse Fast Fourier Transform (IFFT): Convert
frequency-domain symbols to a time-domain signal.
4. Add Cyclic Prefix: Prevent inter-symbol interference
(ISI).
5. Channel Simulation: Add noise, fading, etc.
6. Receiver Processing: Reverse the above steps.
MATLAB Implementation of OFDM
Here’s a simplified OFDM system:
Parameters:
• Number of subcarriers: N = 64
• Modulation: QPSK
• Cyclic Prefix Length: L = 16
% Parameters
N = 64; % Number of subcarriers
L = 16; % Cyclic Prefix Length
numSymbols = 100; % Number of OFDM symbols
% Generate random QPSK symbols
data = randi([0 3], N, numSymbols); % QPSK: 0,
1, 2, 3
qpskModulated = exp(1j * (pi/2 * data)); % Map
to QPSK constellation
% IFFT (Time-domain signal generation)
ofdmSymbols = ifft(qpskModulated, N);

% Add cyclic prefix


cyclicPrefix = ofdmSymbols(end-L+1:end, :); %
Last L samples
txSignal = [cyclicPrefix; ofdmSymbols]; %
Transmitted signal

% Channel Simulation (AWGN + Multipath)


SNR = 20; % Signal-to-Noise Ratio
chan = [0.9 0.5 0.2]; % Example multipath
channel
fadedSignal = filter(chan, 1, txSignal(:)); %
Apply multipath channel
fadedSignal = filter(chan, 1, txSignal(:));
% Apply multipath
rxSignal = awgn(fadedSignal, SNR,
'measured'); % Add noise

% Receiver: Remove cyclic prefix and perform


FFT
rxSignal = reshape(rxSignal, N+L,
numSymbols); % Reshape to symbols
rxSignal = rxSignal(L+1:end, :); % Remove
cyclic prefix
rxSymbols = fft(rxSignal, N); % Convert to
frequency domain
% Demodulation (QPSK detection)
detectedData = round((angle(rxSymbols) + pi) /
(pi/2)); % Map to 0-3
detectedData(detectedData == 4) = 0; % Handle
wrap-around

% BER Calculation
numErrors = sum(data(:) ~= detectedData(:));
BER = numErrors / numel(data);
disp(['OFDM BER: ', num2str(BER)]);

You might also like