0% found this document useful (0 votes)
8 views6 pages

Exp 8

The document outlines an experiment to simulate an Orthogonal Frequency Division Multiplexing (OFDM) system using Binary Phase Shift Keying (BPSK) modulation in MATLAB. It details the theory behind OFDM and BPSK, the algorithm for simulation, and provides MATLAB code for generating and visualizing the OFDM signal. The experiment emphasizes the importance of cyclic prefixes and subcarrier orthogonality in preventing interference during transmission.

Uploaded by

shreya khatu
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)
8 views6 pages

Exp 8

The document outlines an experiment to simulate an Orthogonal Frequency Division Multiplexing (OFDM) system using Binary Phase Shift Keying (BPSK) modulation in MATLAB. It details the theory behind OFDM and BPSK, the algorithm for simulation, and provides MATLAB code for generating and visualizing the OFDM signal. The experiment emphasizes the importance of cyclic prefixes and subcarrier orthogonality in preventing interference during transmission.

Uploaded by

shreya khatu
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/ 6

EXPERIMENT NO 8

Aim : To simulate an Orthogonal Frequency Division Multiplexing (OFDM) system with


Binary Phase Shift Keying (BPSK) modulation.
Software Used : MATLAB online
Theory:
Orthogonal Frequency Division Multiplexing (OFDM): OFDM is a multi-carrier modulation
technique in which a high-data-rate signal is divided across multiple closely spaced subcarriers,
each carrying a lower data rate. Each subcarrier is modulated with a symbol (often using BPSK,
QPSK, or QAM), and they are orthogonally spaced in the frequency domain to avoid
interference.
The transmitted OFDM symbol is the Inverse Fast Fourier Transform (IFFT) of the modulated
subcarrier symbols:

where:
• X[k] is the data symbol for the k-th subcarrier,
• N is the number of subcarriers,
• x[n] is the time-domain signal after IFFT.

Binary Phase Shift Keying (BPSK): BPSK is a binary modulation scheme where each bit is
represented by one of two phases (0 or π), corresponding to symbols 1 or -1. BPSK is robust
to noise and is often used for its simplicity in modulating the subcarriers in OFDM systems.
Cyclic Prefix: A cyclic prefix is added at the beginning of each OFDM symbol to prevent inter-
symbol interference (ISI) caused by multipath propagation. The prefix is a copy of the last few
samples of the OFDM symbol and ensures that the cyclic nature of the OFDM symbol is
preserved even after time dispersion.
Orthogonality of Subcarriers: The subcarriers in OFDM are spaced by 1/T (where T is the
OFDM symbol duration), ensuring that each subcarrier's sinc function in the frequency domain
has zero crossings at the other subcarrier frequencies. This is achieved by selecting frequencies
fk such that:

This ensures no interference among subcarriers despite their overlap.


Realization of subcarrier orthogonality
Algorithm:
1. Parameter Initialization:
o Set the number of subcarriers (N), cyclic prefix length (CP_len), and the number
of bits to transmit (num_bits).
2. Generate BPSK Symbols:
o Generate random bits (0 or 1), then map them to BPSK symbols (-1 and 1).
3. OFDM Modulation:
o Reshape the bitstream into symbols for each subcarrier.
o Apply the IFFT to each symbol to transform data from the frequency domain to
the time domain.
o Add a cyclic prefix by appending the last CP_len samples to the beginning of
each OFDM symbol.
4. Add Noise (optional):
o Add Gaussian noise to simulate transmission through a noisy channel.
5. Visualization:
o Plot the real and imaginary parts of the OFDM signal.
o Plot overlapping sinc functions to visualize the orthogonal nature of subcarriers.
Flowchart:
Code:
main();
function main()
% Parameters
N = 32; % Number of subcarriers
CP_len = 16; % Length of cyclic prefix
num_bits = 128; % Number of bits to transmit

% Generate random bits (1 or -1 for BPSK)


bits = randi([0, 1], num_bits, 1);
bits = 2 * bits - 1; % Convert to BPSK symbols

% OFDM Modulation
ofdm_signal = ofdm_modulate(bits, N, CP_len);

% Add noise (optional, for testing purposes)


ofdm_signal_noisy = ofdm_signal + 0.1 * randn(size(ofdm_signal));

% Visualize OFDM waveform


visualize_ofdm_waveform(ofdm_signal, 'Original OFDM Signal');

% Plot overlapping sinc subcarriers


plot_subcarriers(N);
end

function ofdm_signal = ofdm_modulate(bits, N, CP_len)


% N: Number of subcarriers
% CP_len: Length of the cyclic prefix
% bits: Input bit stream (1 or -1 for BPSK)

% Number of symbols (each symbol modulates N subcarriers)


num_symbols = length(bits) / N;
bits = reshape(bits(1:N*num_symbols), N, num_symbols);

% IFFT Operation to transform from frequency domain to time domain


ifft_data = ifft(bits);

% Adding cyclic prefix


cyclic_prefix = ifft_data(end-CP_len+1:end, :); % Take last CP_len samples
ofdm_signal = [cyclic_prefix; ifft_data];

% Reshape the matrix to form the OFDM signal


ofdm_signal = ofdm_signal(:); % Serialize the signal
end

function visualize_ofdm_waveform(ofdm_signal, title_str)


% Visualize the real and imaginary parts of the OFDM signal
figure;
subplot(2, 1, 1);
plot(real(ofdm_signal));
title([title_str, ' (Real Part)']);
xlabel('Sample Index');
ylabel('Amplitude');

subplot(2, 1, 2);
plot(imag(ofdm_signal));
title([title_str, ' (Imaginary Part)']);
xlabel('Sample Index');
ylabel('Amplitude');
end

function plot_subcarriers(N)
% N: Number of subcarriers

% Frequency axis for plotting


f = linspace(-4, 5, 1000); % Frequency range (adjust this for clearer plotting)

% Initialize figure
figure;
hold on;

% Plot each subcarrier as a sinc function (which represents the frequency domain
representation)
for k = -2:2 % Plot a few subcarriers around the center (adjust for visibility)
% Subcarrier as a sinc function centered at k
subcarrier = sinc(f - k);
plot(f, subcarrier, 'DisplayName', ['Subcarrier ', num2str(k)]);
end

% Add labels, title, and legend


title('Orthogonally Spaced Overlapping Subcarriers');
xlabel('Subcarriers Index');
ylabel('Amplitude');
legend show;
grid on;
hold off;
end
Output:

Conclusion:

You might also like