Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
3 views1 page

Code Ofdm

The document outlines a simulation for an OFDM (Orthogonal Frequency Division Multiplexing) system, including data generation, modulation, IFFT processing, and the introduction of AWGN (Additive White Gaussian Noise). It calculates the Bit Error Rate (BER) across various Signal to Noise Ratios (SNR) and compares the results with theoretical BPSK performance. The results are visualized in a semi-logarithmic plot showing the relationship between SNR and BER.

Uploaded by

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

Code Ofdm

The document outlines a simulation for an OFDM (Orthogonal Frequency Division Multiplexing) system, including data generation, modulation, IFFT processing, and the introduction of AWGN (Additive White Gaussian Noise). It calculates the Bit Error Rate (BER) across various Signal to Noise Ratios (SNR) and compares the results with theoretical BPSK performance. The results are visualized in a semi-logarithmic plot showing the relationship between SNR and BER.

Uploaded by

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

clear all

close all
clc
% Initialization
N = 64; % Number of subchannels
Guard_Interval = N/4;% Guard interval length
q = 2; % Modulation level
nloop = 1; % Number of iteration
SNR= 0:10; % signal to noise ratio vector in dB
EsN0dB = SNR + 10*log10(64/80); % converting to symbol to noise ratio
nsymb=100;
%%
for( ebn0 = 1 : length(SNR))

%% Transmitter
%% Data generation
Data_In = randi([0 1],1,N*nsymb)

%% Modualtion
data_vec=qammod(Data_In,q);
Data_Mod = reshape( data_vec,nsymb,N);
%% IFFT
Data_IFFT = sqrt(N)*ifft(Data_Mod.',N).';
%% Guard interval insertion
Data_CP = [Data_IFFT(:,N- Guard_Interval + 1 : N) Data_IFFT];
%% P/S conversion
[a b]=size(Data_CP);
Data_Tx=reshape(Data_CP,a*b,1);
%% Channel Effect
%% AWGN
Data_Noise = awgn(Data_Tx,EsN0dB(ebn0),'measured');

%% Receiver
%% S/P conversion
Data_Rx=reshape(Data_Noise,a,b);
%% Guard interval removal
Data_Removeal_CP = Data_Rx(:,Guard_Interval+1:N+Guard_Interval);
%% FFT
Data_FFT = (1/sqrt(N))*fft(Data_Removeal_CP.',N).';
%% Demodualtion
Data_Out = qamdemod(Data_FFT,q);
Data_est=reshape( Data_Out,1,nsymb*N);
%% BER
%
nErr(ebn0)= size(find([Data_est- Data_In]),2)

end
simber=nErr/(N*nsymb);
simberbpsk=0.5*erfc(sqrt( 10.^(SNR/10)));
semilogy(SNR,simber,'r-','LineWidth',2);
hold on
semilogy(SNR,simberbpsk,'b-','LineWidth',2);
axis([0 10 10^-5 0.5])
xlabel('Signal to Noise Ratio [SNR] in dB');
ylabel('Bit Error Rate [BER]')
legend('OFDM')

You might also like