THE UNIVERSITY OF TEXAS AT DALLAS
DEPARTMENT OF ELECTRICAL ENGINEERING
EESC 6390 – Introduction to Wireless Communication
Spring 2015
Final Project
Physical Layer Simulation of a Simplified
LTE-OFDM System
Submitted By:
Name Contribution
Krishna Prasad Sreenivassa Rao
50 %
Manjunath Swamy
50 %
1. Introduction:
Orthogonal frequency-division multiplexing (OFDM) is a method of encoding digital data on
multiple sub-carriers. Sub carrier frequencies are chosen so that they are orthogonal to each other
to eliminate cross talk. Long Term Evolution (LTE) uses 12 sub-carriers with each subcarrier
separated from each other by a bandwidth of 15 kHz. LTE standard defines several parameters
like channel bandwidth, FFT size etc. all of which have been mentioned in the subsequent
sections.
The signals are modulated using QPSK, 16 or 64-QAM. Data is assembled in the frequency
domain, modulated and then converted to time domain using inverse fast Fourier transform at the
transmitter and a fast Fourier transform at the receiver to retrieve the original coefficients. Cyclic
prefixes are added to the signal and then transmitted. At the receiver the extra bits are removed,
Fourier transformed and demodulated to retrieve the sent data. The basic block diagram of
OFDM transmitter and receiver is shown below:
Fig
Figure: Block diagram of OFDM transmitter
Figure: Block diagram of OFDM receiver
2. Specifications:
a. Group Number : 2
b. Channel bandwidth: 3 MHz (According to UTD IDs)
c. Modulation Types: QPSK, 16-QAM
d. FFT size (Nfft): 308
e. CP length (Ncp): 18
f. No. of used sub-carriers (Nused): 12 (per resource block for 15 resource blocks)
g. No. of data subcarriers per symbol (Ndata): 180
h. No. of null subcarriers (Nleft, Ndc, and Nright): 128
i. Channel Impulse response model: Channel B (indoor & outdoor)
3. Simulation Method:
An OFDM block of 7 symbols is constructed, with each symbol comprising of 308 bits.
Out of the 308 bits, 180 bits carry the data to be transmitted, while the remaining are null
sub-carriers. No pilot bits, in particular, are used for this simulation. If required, pilot bits
can be accommodated as a part of data bits (Ndata).
According to LTE standard, for 3 MHz channel bandwidth, each sub-carrier occupies 15
kHz and 12 such sub-carriers are required for the transmission of each OFDM symbol,
thus occupying 180 kHz. At a time instant, 15 resource blocks are transmitted, thereby
sending 15 OFDM symbols, thus occupying 2.7 MHz (180 kHz * 15). The remaining 0.3
MHz (10 % of the channel bandwidth) is occupied by guard bands.
Figure: The Basic LTE Downlink Physical Resource seen as a time-frequency grid
OFDM symbols are sent across AWGN and Rayleigh Channels. For Rayleigh channels,
two models have been specified (Channel A and Channel B) for indoor and outdoor
environments. For our group number (2), we have taken values for Channel B. The
impulse response of the channel is known to the receiver, thus facilitating easy decoding
of transmitted signals. In both AWGN and Rayleigh channel cases, the noise is added to
the signal according to the given SNR values and the variation of Bit Error Rate (BER) is
observed with SNR.
Again using the channel impulse response models and a given target Bit Error rate, target
SNRs for the given constellation sizes are determined. LTE specifies only limited
constellation sizes, namely 4, 16 and 64. Since the SNR of the received signal changes
due to channel impulse response (for indoor and outdoor), the target SNR is compared
with the received SNR, following which, the allowable constellation size (for LTE
standard)is determined which in turn is used to find the number of bits to be transmitted
(Spectral Efficiency) corresponding to each target SNR, which is then plotted.
All plots are generated over several Monte-Carlo iterations.
4. Simulations:
i. AWGN Channel, QPSK Modulation
%Program to compute BER vs SNR for LTE-OFDM (QPSK modulation) in an AWGN
%Channel
clc;
clear all;
close all;
%LTE Specifications
N = 308; %FFT Size
Nfft = 308;
Ndata = 180; %% Data points
Ncp = 18; %% Cylic Prefix
NLeft = 63; %%
NRight = 64; %%
SNR = 3:2:11; %% Given SNR Range
monte_carlo_limit = 50;
T = 7;
for s = 1:length(SNR) % SNR loop
for monte_carlo_index = 1:monte_carlo_limit %Monte carlo loop
nooferrors = 0;
for i=1:1:15
raw_data = randi([0 1],1,2*1260);%% Data bits generated
raw_data_combine(1,i*2*1260-2*1260+1:i*2*1260) = raw_data; %Storing data-bits for 15
resource blocks
reshaped = reshape(raw_data,2,1260)'; %%reshaping data-bits for modulation
bin_to_gray = (bin2gray(bi2de(reshaped,'left-msb'),'psk',4))';%% Binary to gray
mapping
modulated = pskmod(bin_to_gray,4,0,'gray');%% QPSK Modulation
ofdm_symbol_data = reshape(modulated,180,T)';%% Isolating data bits for each symbols
for t = 1:T
ofdm_sequence(t,:) = [0 ofdm_symbol_data(t,91:180) zeros(1,NLeft+NRight)
ofdm_symbol_data(t,1:90)]; %Constructing transmission sequence
ofdm_ifft(t,:) = sqrt(N)*ifft(ofdm_sequence(t,:));%% Time domain conversion, for
transmission
tx(t,:) = [ofdm_ifft(t,308-Ncp+1:308) ofdm_ifft(t,:)];%% Adding CPs
end
tx_combine(t+(i-1)*7-6:t+(i-1)*7,:)=tx; % Storing modulated data-bits (time domain)
for 15-resource blocks
end
rx_combine = awgn(tx_combine,SNR(s),'measured'); % Signal received at the receiver (after
travelling through AWGN channel)
for t=1:1:105
rx_ofdm_symbol(t,:) = rx_combine(t,Ncp+1:326); %Removing Cyclic Prefix
rx_sequence(t,:) = fft(rx_ofdm_symbol(t,:))/sqrt(N); % Time-to-Frequency domain
conversion
rx_raw_data(t,:) = [rx_sequence(t,219:308) rx_sequence(t,2:91)]; %Extracting data
bits
end
rx_symbol_data= reshape(rx_raw_data',1,180*105);%% Isolating data bits corresponding to
15 resource blocks (containing 180 data bits per symbol)
demodulated = pskdemod(rx_symbol_data,4,0,'gray');%% QPSK Demodulation
gray_to_binary = (de2bi(gray2bin(demodulated,'psk',4),'left-msb'))';%% Binary Conversion
from Gray
final_data = reshape(gray_to_binary,1,180*2*105); % reshaping after demodulation
nooferrors = nooferrors + sum(xor(final_data,raw_data_combine));%% Comparison of received
& transmitted data for bit errors
BER(monte_carlo_index) = nooferrors/(180*2*105);%% Bit errors averaged over monte-carlo
iterations
end
BER_avg(s)=mean(BER);%% Mean bit error for every SNR
end
% Plotting BER vs SNR
figure
semilogy(SNR,BER_avg);
title('LTE-OFDM QPSK Modulation for AWGN');
ylabel('BIT ERROR RATE');
xlabel('SNR (dB)');
Published with MATLAB® R2014a
ii. AWGN Channel, 16-QAM Modulation
%Program to compute BER vs SNR for LTE-OFDM (16-QAM modulation) in an AWGN
%Channel
clc;
clear all;
close all;
%LTE Specifications
N = 308; %FFT Size
Nfft = N;
Ndata = 180; %% Data points
Ncp = 18; %% Cylic Prefix
NLeft = 63; %%
NRight = 64; %%
SNR = 3:2:11; %% Given SNR Range
monte_carlo_limit = 50;
T = 7;
for s = 1:length(SNR) % SNR loop
for monte_carlo_index=1:monte_carlo_limit %Monte carlo loop
nooferrors = 0;
for i=1:1:15
raw_data = randi([0 1],1,4*1260);%% Data bits generated
raw_data_combine(1,i*4*1260-4*1260+1:i*4*1260)=raw_data; %Storing data-bits for 15
resource blocks
reshaped = reshape(raw_data,4,1260)';%%reshaping data-bits for modulation
bin_to_gray = (bin2gray(bi2de(reshaped,'left-msb'),'psk',16))';%%Binary to gray
mapping
modulated = qammod(bin_to_gray,16,0,'gray');%% 16 QAM Modulation
ofdm_symbol_data = reshape(modulated,180,T)';%% Isolating data bits for each symbols
for t = 1:T
ofdm_sequence(t,:) = [0 ofdm_symbol_data(t,91:180) zeros(1,NLeft+NRight)
ofdm_symbol_data(t,1:90)]; %Constructing transmission sequence
ofdm_ifft(t,:) = sqrt(N)*ifft(ofdm_sequence(t,:));%% Time domain conversion, for
transmission
tx(t,:) = [ofdm_ifft(t,308-Ncp+1:308) ofdm_ifft(t,:)];%% Adding CPs
end
tx_combine(t+(i-1)*7-6:t+(i-1)*7,:) = tx;% Storing modulated data-bits (time domain)
for 15-resource blocks
end
rx_combine=awgn(tx_combine,SNR(s),'measured');% Signal received at the receiver (after
travelling through AWGN channel)
for t=1:1:105
rx_ofdm_symbol(t,:) = rx_combine(t,Ncp+1:326); %Removing Cyclic Prefix
rx_sequence(t,:) = fft(rx_ofdm_symbol(t,:))/sqrt(N); % Time-to-Frequency domain
conversion
rx_raw_data(t,:) = [rx_sequence(t,219:308) rx_sequence(t,2:91)]; %Extracting data
bits
end
rx_symbol_data= reshape(rx_raw_data',1,180*105); %% Isolating data bits corresponding to
15 resource blocks (containing 180 data bits per symbol)
demodulated = qamdemod(rx_symbol_data,16,0,'gray');%% 16-QAM Demodulation
gray_to_binary = (de2bi(gray2bin(demodulated,'psk',16),'left-msb'))';%% Binary Conversion
from Gray
final_data = reshape(gray_to_binary,1,180*4*105); % reshaping after demodulation
nooferrors = nooferrors + sum(xor(final_data,raw_data_combine));%% Comparison of received
& transmitted data for bit errors
BER(monte_carlo_index) = nooferrors/(180*4*105);%% Bit errors averaged over monte-carlo
iterations
end
BER_avg(s)=mean(BER);%% Mean bit error for every SNR
end
% Plotting BER vs SNR
figure
semilogy(SNR,BER_avg);
title('LTE-OFDM 16-QAM Modulation for AWGN Channel');
ylabel('BIT ERROR RATE');
xlabel('SNR (dB)');
Published with MATLAB® R2014a
iii. Rayleigh Channel (Indoor – Channel B), QPSK Modulation
%Program to compute BER vs SNR for LTE-OFDM (QPSK modulation) in an
%Rayleigh Channel
clc;
clear all;
close all;
%LTE Specifications
N = 308; %%FFT Size
Nfft = N;
Ndata = 180; %% Data points
Ncp = 18; %% Cylic Prefix
NLeft = 63; %%
NRight = 64; %%
SNR = 10:2:40; %% Given SNR Range
monte_carlo_limit = 100;
% Indoor Channel Response (Channel B)
delay = [0 100 200 300 500 700]; %Array with tap delay times
powerDB = [0 -3.6 -7.2 -10.8 -18.0 -25.2]; %Array with power distribution
tap_no = ceil(max(delay)*(10^(-9))*3*10^6); %No. of taps (Max delay / Sampling time)
h_indoor = zeros(1,tap_no+1); %Initializing Rayleigh channel response matrix
L = length(delay);
powerRatio = 10.^(powerDB/10); %Power from DB to ratio form
temp = randn(1,L)+j*randn(1,L);
%Populating Rayleigh channel response matrix
for k=1:L
h_indoor(k)=sqrt(powerRatio(k)/2).*real(temp(k))+j*sqrt(powerRatio(k)/2).*imag(temp(k));
end
T = 7;
for s = 1:length(SNR) % SNR loop
for monte_carlo_index=1:monte_carlo_limit % Monte-carlo loop
nooferrors = 0;
for i=1:1:15
raw_data = randi([0 1],1,2*1260);%% Data bits generated
raw_data_combine(1,i*2*1260-2*1260+1:i*2*1260)=raw_data; %Storing data-bits for 15
resource blocks
reshaped = reshape(raw_data,2,1260)';%%reshaping data-bits for modulation
bin_to_gray = (bin2gray(bi2de(reshaped,'left-msb'),'psk',4))';%%Binary to gray
mapping
modulated = pskmod(bin_to_gray,4,0,'gray');%%QPSK Modulation
ofdm_symbol_data = reshape(modulated,180,T)';%% Isolating data bits for each symbols
for t = 1:T
ofdm_sequence(t,:) = [0 ofdm_symbol_data(t,91:180) zeros(1,NLeft+NRight)
ofdm_symbol_data(t,1:90)]; %Constructing transmission sequence
ofdm_ifft(t,:) = sqrt(N)*ifft(ofdm_sequence(t,:));%% Time domain conversion, for
transmission
tx(t,:) = [ofdm_ifft(t,308-Ncp+1:308) ofdm_ifft(t,:)];%% Adding CPs
end
tx_combine(t+(i-1)*7-6:t+(i-1)*7,:) = tx; % Storing modulated data-bits (time domain)
for 15-resource blocks
end
%Convolving transmitted signal with channel impulse response
for u=1:1:105
convDataVeh(u,:) = conv(tx_combine(u,:),h_indoor);
end
%Adding noise to the system (after passing through Rayleigh channel)
rx_combine=awgn(convDataVeh,SNR(s),'measured');
for t=1:1:105
rx_ofdm_symbol(t,:) = rx_combine(t,Ncp+1:326); %Removing Cyclic Prefix
hf = fft(h_indoor,308);% Time-to-Frequency domain conversion of impulse response
recf(t,:) = fft(rx_ofdm_symbol(t,:),308); %F-domain conversion of the received signal
rec(t,:) = ifft(recf(t,:)./hf); %Eliminating the effect of Rayleigh channel fading
rx_sequence(t,:) = fft(rec(t,:))/sqrt(N); % FFT of the received signal without
fading
rx_raw_data(t,:) = [rx_sequence(t,219:308) rx_sequence(t,2:91)]; %Extracting data
bits
end
rx_symbol_data= reshape(rx_raw_data',1,180*105);%% Isolating data bits corresponding to
15 resource blocks (containing 180 data bits per symbol)
demodulated = pskdemod(rx_symbol_data,4,0,'gray');%% QPSK Demodulation
gray_to_binary = (de2bi(gray2bin(demodulated,'psk',4),'left-msb'))';%% Binary Conversion
from Gray
final_data = reshape(gray_to_binary,1,180*2*105);% reshaping after demodulation
nooferrors = nooferrors + sum(xor(final_data,raw_data_combine));%% Comparison of received
& transmitted data for bit errors
BER(monte_carlo_index) = nooferrors/(180*2*105);%% Bit errors averaged over monte-carlo
iterations
end
BER_avg(s)=mean(BER);%% Mean bit error for every SNR
end
% Plotting BER vs SNR
figure
semilogy(SNR,BER_avg);
title('LTE-OFDM QPSK Modulation - Indoor Rayleigh Channel');
ylabel('BIT ERROR RATE');
xlabel('SNR (dB)');
Published with MATLAB® R2014a
iv. Rayleigh Channel (Outdoor – Channel B), QPSK Modulation
%Program to compute BER vs SNR for LTE-OFDM (QPSK modulation) in an
%Rayleigh Channel
clc;
clear all;
close all;
%LTE Specifications
N = 308; %%FFT Size
Nfft = N;
Ndata = 180; %% Data points
Ncp = 18; %% Cylic Prefix
NLeft = 63; %%
NRight = 64; %%
SNR = 10:2:40; %% Given SNR Range
monte_carlo_limit = 100;
% Outdoor Channel Response (Channel B)
delay = [0 5 30 45 75 90 105 140 210 230 250 270 275 475 595 690]; %Array with tap delay times
powerDB = [-1.5 -10.2 -16.6 -19.2 -20.9 -20.6 -16.6 -16.6 -23.9 -12 -23.9 -21 -17.7 -24.6 -22 -
29.2]; %Array with power distribution
tap_no = ceil(max(delay)*(10^(-9))*3*10^6); %No. of taps (Max delay / Sampling time)
h_indoor = zeros(1,tap_no+1); %Initializing Rayleigh channel response matrix
L = length(delay);
powerRatio = 10.^(powerDB/10); %Power from DB to ratio form
temp = randn(1,L)+j*randn(1,L);
%Populating Rayleigh channel response matrix
for k=1:L
h_indoor(k)=sqrt(powerRatio(k)/2).*real(temp(k))+j*sqrt(powerRatio(k)/2).*imag(temp(k));
end
T = 7;
for s = 1:length(SNR) % SNR loop
for monte_carlo_index=1:monte_carlo_limit % Monte-carlo loop
nooferrors = 0;
for i=1:1:15
raw_data = randi([0 1],1,2*1260);%% Data bits generated
raw_data_combine(1,i*2*1260-2*1260+1:i*2*1260)=raw_data; %Storing data-bits for 15
resource blocks
reshaped = reshape(raw_data,2,1260)';%%reshaping data-bits for modulation
bin_to_gray = (bin2gray(bi2de(reshaped,'left-msb'),'psk',4))';%%Binary to gray
mapping
modulated = pskmod(bin_to_gray,4,0,'gray');%%QPSK Modulation
ofdm_symbol_data = reshape(modulated,180,T)';%% Isolating data bits for each symbols
for t = 1:T
ofdm_sequence(t,:) = [0 ofdm_symbol_data(t,91:180) zeros(1,NLeft+NRight)
ofdm_symbol_data(t,1:90)]; %Constructing transmission sequence
ofdm_ifft(t,:) = sqrt(N)*ifft(ofdm_sequence(t,:));%% Time domain conversion, for
transmission
tx(t,:) = [ofdm_ifft(t,308-Ncp+1:308) ofdm_ifft(t,:)];%% Adding CPs
end
tx_combine(t+(i-1)*7-6:t+(i-1)*7,:) = tx; % Storing modulated data-bits (time domain)
for 15-resource blocks
end
%Convolving transmitted signal with channel impulse response
for u=1:1:105
convDataVeh(u,:) = conv(tx_combine(u,:),h_indoor);
end
%Adding noise to the system (after passing through Rayleigh channel)
rx_combine=awgn(convDataVeh,SNR(s),'measured');
for t=1:1:105
rx_ofdm_symbol(t,:) = rx_combine(t,Ncp+1:326); %Removing Cyclic Prefix
hf = fft(h_indoor,308);% Time-to-Frequency domain conversion of impulse response
recf(t,:) = fft(rx_ofdm_symbol(t,:),308); %F-domain conversion of the received signal
rec(t,:) = ifft(recf(t,:)./hf); %Eliminating the effect of Rayleigh channel fading
rx_sequence(t,:) = fft(rec(t,:))/sqrt(N); % FFT of the received signal without
fading
rx_raw_data(t,:) = [rx_sequence(t,219:308) rx_sequence(t,2:91)]; %Extracting data
bits
end
rx_symbol_data= reshape(rx_raw_data',1,180*105);%% Isolating data bits corresponding to
15 resource blocks (containing 180 data bits per symbol)
demodulated = pskdemod(rx_symbol_data,4,0,'gray');%% QPSK Demodulation
gray_to_binary = (de2bi(gray2bin(demodulated,'psk',4),'left-msb'))';%% Binary Conversion
from Gray
final_data = reshape(gray_to_binary,1,180*2*105);% reshaping after demodulation
nooferrors = nooferrors + sum(xor(final_data,raw_data_combine));%% Comparison of received
& transmitted data for bit errors
BER(monte_carlo_index) = nooferrors/(180*2*105);%% Bit errors averaged over monte-carlo
iterations
end
BER_avg(s)=mean(BER);%% Mean bit error for every SNR
end
% Plotting BER vs SNR
figure
semilogy(SNR,BER_avg);
title('LTE-OFDM QPSK Modulation - Outdoor Rayleigh Channel');
ylabel('BIT ERROR RATE');
xlabel('SNR (dB)');
Published with MATLAB® R2014a
v. Rayleigh Channel (Indoor – Channel B), 16 QAM Modulation
%Program to compute BER vs SNR for LTE-OFDM (16QAM modulation) in an
%Rayleigh Channel
clc;
clear all;
close all;
%LTE Specifications
N = 308; %%FFT Size
Nfft = N;
Ndata = 180; %% Data points
Ncp = 18; %% Cylic Prefix
NLeft = 63; %%
NRight = 64; %%
SNR = 10:2:40; %% Given SNR Range
monte_carlo_limit = 100;
% Indoor Channel Response (Channel B)
delay = [0 100 200 300 500 700]; %Array with tap delay times
powerDB = [0 -3.6 -7.2 -10.8 -18.0 -25.2]; %Array with power distribution
tap_no = ceil(max(delay)*(10^(-9))*3*10^6); %No. of taps (Max delay / Sampling time)
h_indoor = zeros(1,tap_no+1); %Initializing Rayleigh channel response matrix
L = length(delay);
powerRatio = 10.^(powerDB/10); %Power from DB to ratio form
temp = randn(1,L)+j*randn(1,L);
%Populating Rayleigh channel response matrix
for k=1:L
h_indoor(k)=sqrt(powerRatio(k)/2).*real(temp(k))+j*sqrt(powerRatio(k)/2).*imag(temp(k));
end
T = 7;
for s = 1:length(SNR) % SNR loop
for monte_carlo_index=1:monte_carlo_limit % Monte-carlo loop
nooferrors = 0;
for i=1:1:15
raw_data = randi([0 1],1,4*1260);%% Data bits generated
raw_data_combine(1,i*4*1260-4*1260+1:i*4*1260)=raw_data; %Storing data-bits for 15
resource blocks
reshaped = reshape(raw_data,4,1260)';%%reshaping data-bits for modulation
bin_to_gray = (bin2gray(bi2de(reshaped,'left-msb'),'psk',16))';%%Binary to gray
mapping
modulated = qammod(bin_to_gray,16,0,'gray');%%16QAM Modulation
ofdm_symbol_data = reshape(modulated,180,T)';%% Isolating data bits for each symbols
for t = 1:T
ofdm_sequence(t,:) = [0 ofdm_symbol_data(t,91:180) zeros(1,NLeft+NRight)
ofdm_symbol_data(t,1:90)]; %Constructing transmission sequence
ofdm_ifft(t,:) = sqrt(N)*ifft(ofdm_sequence(t,:));%% Time domain conversion, for
transmission
tx(t,:) = [ofdm_ifft(t,308-Ncp+1:308) ofdm_ifft(t,:)];%% Adding CPs
end
tx_combine(t+(i-1)*7-6:t+(i-1)*7,:) = tx; % Storing modulated data-bits (time domain)
for 15-resource blocks
end
%Convolving transmitted signal with channel impulse response
for u=1:1:105
convDataVeh(u,:) = conv(tx_combine(u,:),h_indoor);
end
%Adding noise to the system (after passing through Rayleigh channel)
rx_combine=awgn(convDataVeh,SNR(s),'measured');
for t=1:1:105
rx_ofdm_symbol(t,:) = rx_combine(t,Ncp+1:326); %Removing Cyclic Prefix
hf = fft(h_indoor,308);% Time-to-Frequency domain conversion of impulse response
recf(t,:) = fft(rx_ofdm_symbol(t,:),308); %F-domain conversion of the received signal
rec(t,:) = ifft(recf(t,:)./hf); %Eliminating the effect of Rayleigh channel fading
rx_sequence(t,:) = fft(rec(t,:))/sqrt(N); % FFT of the received signal without
fading
rx_raw_data(t,:) = [rx_sequence(t,219:308) rx_sequence(t,2:91)]; %Extracting data
bits
end
rx_symbol_data= reshape(rx_raw_data',1,180*105);%% Isolating data bits corresponding to
15 resource blocks (containing 180 data bits per symbol)
demodulated = qamdemod(rx_symbol_data,16,0,'gray');%% 16QAM Demodulation
gray_to_binary = (de2bi(gray2bin(demodulated,'psk',16),'left-msb'))';%% Binary Conversion
from Gray
final_data = reshape(gray_to_binary,1,180*4*105);% reshaping after demodulation
nooferrors = nooferrors + sum(xor(final_data,raw_data_combine));%% Comparison of received
& transmitted data for bit errors
BER(monte_carlo_index) = nooferrors/(180*4*105);%% Bit errors averaged over monte-carlo
iterations
end
BER_avg(s)=mean(BER);%% Mean bit error for every SNR
end
% Plotting BER vs SNR
figure
semilogy(SNR,BER_avg);
title('LTE-OFDM 16QAM Modulation - Indoor Rayleigh');
ylabel('BIT ERROR RATE');
xlabel('SNR (dB)');
Published with MATLAB® R2014a
vi. Rayleigh Channel (Outdoor – Channel B), 16 QAM Modulation
%Program to compute BER vs SNR for LTE-OFDM (16QAM modulation) in an
%Rayleigh Channel
clc;
clear all;
close all;
%LTE Specifications
N = 308; %%FFT Size
Nfft = N;
Ndata = 180; %% Data points
Ncp = 18; %% Cylic Prefix
NLeft = 63; %%
NRight = 64; %%
SNR = 10:2:40; %% Given SNR Range
monte_carlo_limit = 100;
% Outdoor Channel Response (Channel B)
delay = [0 5 30 45 75 90 105 140 210 230 250 270 275 475 595 690]; %Array with tap delay times
powerDB = [-1.5 -10.2 -16.6 -19.2 -20.9 -20.6 -16.6 -16.6 -23.9 -12 -23.9 -21 -17.7 -24.6 -22 -
29.2]; %Array with power distribution
tap_no = ceil(max(delay)*(10^(-9))*3*10^6); %No. of taps (Max delay / Sampling time)
h_outdoor = zeros(1,tap_no+1); %Initializing Rayleigh channel response matrix
L = length(delay);
powerRatio = 10.^(powerDB/10); %Power from DB to ratio form
temp = randn(1,L)+j*randn(1,L);
%Populating Rayleigh channel response matrix
for k=1:L
h_outdoor(k)=sqrt(powerRatio(k)/2).*real(temp(k))+j*sqrt(powerRatio(k)/2).*imag(temp(k));
end
T = 7;
for s = 1:length(SNR) % SNR loop
for monte_carlo_index=1:monte_carlo_limit % Monte-carlo loop
nooferrors = 0;
for i=1:1:15
raw_data = randi([0 1],1,4*1260);%% Data bits generated
raw_data_combine(1,i*4*1260-4*1260+1:i*4*1260)=raw_data; %Storing data-bits for 15
resource blocks
reshaped = reshape(raw_data,4,1260)';%%reshaping data-bits for modulation
bin_to_gray = (bin2gray(bi2de(reshaped,'left-msb'),'psk',16))';%%Binary to gray
mapping
modulated = qammod(bin_to_gray,16,0,'gray');%%16QAM Modulation
ofdm_symbol_data = reshape(modulated,180,T)';%% Isolating data bits for each symbols
for t = 1:T
ofdm_sequence(t,:) = [0 ofdm_symbol_data(t,91:180) zeros(1,NLeft+NRight)
ofdm_symbol_data(t,1:90)]; %Constructing transmission sequence
ofdm_ifft(t,:) = sqrt(N)*ifft(ofdm_sequence(t,:));%% Time domain conversion, for
transmission
tx(t,:) = [ofdm_ifft(t,308-Ncp+1:308) ofdm_ifft(t,:)];%% Adding CPs
end
tx_combine(t+(i-1)*7-6:t+(i-1)*7,:) = tx; % Storing modulated data-bits (time domain)
for 15-resource blocks
end
%Convolving transmitted signal with channel impulse response
for u=1:1:105
convDataVeh(u,:) = conv(tx_combine(u,:),h_outdoor);
end
%Adding noise to the system (after passing through Rayleigh channel)
rx_combine=awgn(convDataVeh,SNR(s),'measured');
for t=1:1:105
rx_ofdm_symbol(t,:) = rx_combine(t,Ncp+1:326); %Removing Cyclic Prefix
hf = fft(h_outdoor,308);% Time-to-Frequency domain conversion of impulse response
recf(t,:) = fft(rx_ofdm_symbol(t,:),308); %F-domain conversion of the received signal
rec(t,:) = ifft(recf(t,:)./hf); %Eliminating the effect of Rayleigh channel fading
rx_sequence(t,:) = fft(rec(t,:))/sqrt(N); % FFT of the received signal without
fading
rx_raw_data(t,:) = [rx_sequence(t,219:308) rx_sequence(t,2:91)]; %Extracting data
bits
end
rx_symbol_data= reshape(rx_raw_data',1,180*105);%% Isolating data bits corresponding to
15 resource blocks (containing 180 data bits per symbol)
demodulated = qamdemod(rx_symbol_data,16,0,'gray');%% 16QAM Demodulation
gray_to_binary = (de2bi(gray2bin(demodulated,'psk',16),'left-msb'))';%% Binary Conversion
from Gray
final_data = reshape(gray_to_binary,1,180*4*105);% reshaping after demodulation
nooferrors = nooferrors + sum(xor(final_data,raw_data_combine));%% Comparison of received
& transmitted data for bit errors
BER(monte_carlo_index) = nooferrors/(180*4*105);%% Bit errors averaged over monte-carlo
iterations
end
BER_avg(s)=mean(BER);%% Mean bit error for every SNR
end
% Plotting BER vs SNR
figure
semilogy(SNR,BER_avg);
title('LTE-OFDM 16QAM Modulation - Outdoor Rayleigh');
ylabel('BIT ERROR RATE');
xlabel('SNR (dB)');
Published with MATLAB® R2014a
vii. Adaptive Modulation
%Program to plot Spectral Efficiency vs SNR for Adaptive Modulation
clc;
clear all;
close all;
N =308; %No.of bits per OFDM symbol
bandwidth = 3*10^6;
SNR = 10:1:30; % SNR Range
targetBER = 10^(-3);
%Allowed Constellation sizes according to LTE Specifications
M=[4 16 64];
%Determining target SNR for each constellation size
for i=1:length(M)
targetSNR(i)=((M(i)-1)*log(5*targetBER))/(-1.5);
end
monte_carlo_limit = 100;
for montecarloindex = 1:1:monte_carlo_limit
% Indoor Channel Response (Channel B)
delay = [0 100 200 300 500 700]; %Array with tap delay times
powerDB = [0 -3.6 -7.2 -10.8 -18.0 -25.2]; %Array with power distribution
tap_no = ceil(max(delay)*(10^(-9))*3*10^6); %No. of taps (Max delay / Sampling time)
h_indoor = zeros(1,tap_no+1); %Initializing Rayleigh channel response matrix
L = length(delay);
powerRatio = 10.^(powerDB/10); %Power from DB to ratio form
temp = randn(1,L)+j*randn(1,L);
%Populating Rayleigh channel response matrix
for k=1:L
h_indoor(k)=sqrt(powerRatio(k)/2).*real(temp(k))+j*sqrt(powerRatio(k)/2).*imag(temp(k));
end
%Frequency domain translation of channel impulse response
H_indoor = fft(h_indoor,308);
%Constellation restriction according to received SNR
for s = 1:length(SNR)
rxSNR = abs(H_indoor.*SNR(s));
for i=1:length(rxSNR)
if rxSNR(i) < targetSNR(1)
constellation(i) = 1; %If received SNR is below Threshold SNR, no transmission is
done.
elseif ((rxSNR(i) > targetSNR(1)) && (rxSNR(i) < targetSNR(2)))
constellation(i) = 4;
elseif ((rxSNR(i) > targetSNR(2)) && (rxSNR(i) < targetSNR(3)))
constellation(i) = 16;
else
constellation(i) = 64;
end
end
%Bits = log2(M)
indoor_efficiency(s) = mean(log2(constellation));
end
%Storing spectral efficiencies for every iteration
temp1(montecarloindex,:) = indoor_efficiency;
% Outdoor Channel Response (Channel B)
delay = [0 5 30 45 75 90 105 140 210 230 250 270 275 475 595 690]; %Array with tap delay
times
powerDB = [-1.5 -10.2 -16.6 -19.2 -20.9 -20.6 -16.6 -16.6 -23.9 -12 -23.9 -21 -17.7 -
24.6 -22 -29.2]; %Array with power distribution
tap_no = ceil(max(delay)*(10^(-9))*3*10^6); %No. of taps (Max delay / Sampling time)
h_outdoor = zeros(1,tap_no+1); %Initializing Rayleigh channel response matrix
L = length(delay);
powerRatio = 10.^(powerDB/10); %Power from DB to ratio form
temp = randn(1,L)+j*randn(1,L);
%Populating Rayleigh channel response matrix
for k=1:L
h_outdoor(k)=sqrt(powerRatio(k)/2).*real(temp(k))+j*sqrt(powerRatio(k)/2).*imag(temp(k));
end
%Frequency domain translation of channel impulse response
H_outdoor = fft(h_outdoor,308);
%Constellation restriction according to received SNR
for s=1:length(SNR)
rxSNR = abs(H_outdoor.*SNR(s));
for i=1:length(rxSNR)
if rxSNR(i) < targetSNR(1)
constellation(i) = 1; %If received SNR is below Threshold SNR, no transmission is
done.
elseif ((rxSNR(i) > targetSNR(1))&&(rxSNR(i) < targetSNR(2)))
constellation(i) = 4;
elseif ((rxSNR(i) > targetSNR(2))&&(rxSNR(i) < targetSNR(3)))
constellation(i) = 16;
else
constellation(i) = 64;
end
end
%Bits = log2(M)
outdoor_efficiency(s) = mean((log2(constellation)));
end
%Storing spectral efficiencies for every iteration
temp2(montecarloindex,:) = outdoor_efficiency;
end
%Calculating the mean spectral efficiency from every Monte Carlo iteration
for k=1:1:21
indoor(:,k) = mean(temp1(:,k));
outdoor(:,k) = mean(temp2(:,k));
end
plot(SNR, indoor,'r');
hold on;
plot(SNR, outdoor,'b');
grid on;
title('Adaptive Modulation');
xlabel('SNR (db)');
ylabel('Spectral efficiency in bits/Hz');
legend('Indoor','Outdoor');
Published with MATLAB® R2014a
5. Conclusion:
The generated information bits were successfully encoded with OFDM modulation according to
LTE standards and the Bit Error Rate vs SNR for every case – like AWGN and Rayleigh (for
indoor and outdoor) were plotted. Adaptive modulation was also simulated where the spectral
efficiency vs SNR was plotted.
6. References: 1. http://www.tsiwireless.com/docs/whitepapers/LTE%20in%20a%20Nutshell%20-
%20Protocol%20Architecture.pdf
2. http://www.radio-electronics.com/info/cellulartelecomms/lte-long-term-
evolution/lte-ofdm-ofdma-scfdma.php
3. http://www.tutorialspoint.com/lte/lte_ofdm_technology.htm
4. http://en.wikipedia.org/wiki/Orthogonal_frequency-division_multiplexing
5. http://lteworld.org/presentation/long-term-evolution-lte-basics
6. http://www.radio-electronics.com/info/cellulartelecomms/lte-long-term-
evolution/3g-lte-basics.php