Black Bird
Newbie level 1
Hello friends,
I am writing a code for simulation a new OFDM technique for AWGN channel. This technique is Time-Frequency Training OFDM. Idea in this technique is to insert some pilot group scattered in complete signal BW and along with this a training sequence is also appended. so, at the receiver side, there a Joint Time-Frequency Channel Estimation, where the contaminated training sequence is used for finding path delay information and pilots are used to evaluate path coefficients.
If u find it interesting, then please help to simulate this technique. just let me knw and i can send more details about technique and my code is as follow:
clc;
clear all;
close all;
format long;
% GENERATION OF INFORMATION AND LDPC ENCODING
I = randint(1,43200); % INFORMATION BITS
H = dvbs2ldpc(2/3);
l = fec.ldpcenc(H);
codeword = encode(l,I);
% BIT-INTERLEAVING
Order = (1:64800).';
hIntrlv = comm.BlockInterleaver(Order);
intrlvrOut = step(hIntrlv,codeword.');
iout = intrlvrOut;
% 64-QAM MODULATION AND MAPPING
hmod =comm.RectangularQAMModulator(64,'BitInput',true);
moutp = step(hmod, iout);
mout = (moutp).';
x = 1;
si = 1;
o = 1;
for snr = 14:0.5:17
for sym = 1:3 % SYMBOL LOOP
data = mout(x:x+3599);
new_sym = zeros(1,3660);
for i = 1:3600
new_sym(i+30) = data(i);
end
p_sym = zeros(1,3780);
d = sort(randint(1, 40, [2 3650])); % random index for central pilot
temp = d;
for i = 1:39
a = d(i+1) - d(i);
if a<5
b =5-a;
d(i+1) = d(i+1) + b;
end
end
pilt = [-1 1 -1]; %BPSK modulated PILOT
for k = 1:40
g = d(k);
for i = 1:g-2;
p_sym(i) = new_sym(i);
end
p_sym(g-1) = -1;
p_sym(g) = 1;
p_sym(g+1) = -1;
for i = g:3660
p_sym(i+2) = new_sym(i);
end
new_sym = p_sym;
end
new_sym = new_sym.'; % SERIAL TO PARALLEL
signal = sqrt(3780) * ifft(new_sym, 3780);
signal = signal.'; % PARALLEL TO SERIAL
% Generating PN-Sequence
load pn_all.mat pn420;
PN420=transpose(pn420(1,);
PN420_MC=sqrt(length(PN420)) * ifft(PN420);
TS = PN420_MC';
z = cxcorr(TS,TS); % For CIRCULAR CORRELATION THEOREM,
% Appending Training Sequence
t_signal = [TS signal]; % SIGNAL TO BE TRANSMITTED
%%
% AWGN channel
%pro = eye(4200) * (t_signal.');
r_signal = awgn(t_signal.', snr, 0);
r_signal = r_signal.';
%%
%TS-based path delay estimation
Tao = 1; %possible paths fro AWGN channel
%%
for i = 1:3780
r_block(i) = r_signal(420+i); % Extracting OFDM Data block
end
trail = fft(r_block.' ,3780)./sqrt(3780);
fft_r_block = trail;
dd = d.';
for n = 1:40
all_pilots(n,1) = dd(n,1)-1;
all_pilots(n,2) = dd(n,1);
all_pilots(n,3) = dd(n,1)+1;
end
cen_plt_index = d;
for i = 1:40
hh = d(i);
cen_plts(i) = fft_r_block(hh); % received central pilots
end
for k = 1:40
g = d(k);
for p_indx = 1:3
trail(g-1) = []; %received data block without pilots
end
end
for i = 1:3600
r_data(i) = trail(i+30); %received data without virtual(/guard) subcarriers
end
%% Path coefficient estimation
for k = 1:40
for n = 0:3779
lem(k,n+1)= 1-(exp(-2j*pi*(n/3780))+exp(2j*pi*(n/3780))); %lemda_i
end
end
for n = 0:3779
thetha(n+1,1) = 1;
thetha(n+1,2) = n; %thetha_n
end
beta = lem*thetha; %beta_i
y_p = cen_plts;
A = ((beta')*beta) + (0.9997 * eye(2)); %noise variance is assumed = 1
B = inv(A);
C = (beta') * (y_p.');
rho_cap = B * C;
h_inl = thetha * rho_cap;
g_i = sum(h_inl)/3780;
G_i = g_i * eye(3780);
%channel equalization: which is ONE-TAP-EQUALIZATION for AWGN channel
x_ik,sym) = r_data.* ( conj(g_i) / ((abs(g_i)^2) + 0.9997) );
end
stream = reshape(x_ik, 1, 10800);
hdmod =comm.RectangularQAMDemodulator(64,'BitOutput',true);
dout = step(hdmod, stream.');
dIntrlv = comm.BlockDeinterleaver(Order);
dintrd = step(dIntrlv,dout);
ddd = fec.ldpcdec(H);
final = decode(ddd,dintrd.');
errors = 0;
be = xor(I,final);
errors = nnz(be);
BER(si,o)=errors/length(I);
o = o+1;
end
si = si+1;
%%
figure
i=14:0.5:17;
semilogy(i,BER);
title('BER vs SNR');
ylabel('BER');
xlabel('SNR (dB)');
grid on
I am writing a code for simulation a new OFDM technique for AWGN channel. This technique is Time-Frequency Training OFDM. Idea in this technique is to insert some pilot group scattered in complete signal BW and along with this a training sequence is also appended. so, at the receiver side, there a Joint Time-Frequency Channel Estimation, where the contaminated training sequence is used for finding path delay information and pilots are used to evaluate path coefficients.
If u find it interesting, then please help to simulate this technique. just let me knw and i can send more details about technique and my code is as follow:
clc;
clear all;
close all;
format long;
% GENERATION OF INFORMATION AND LDPC ENCODING
I = randint(1,43200); % INFORMATION BITS
H = dvbs2ldpc(2/3);
l = fec.ldpcenc(H);
codeword = encode(l,I);
% BIT-INTERLEAVING
Order = (1:64800).';
hIntrlv = comm.BlockInterleaver(Order);
intrlvrOut = step(hIntrlv,codeword.');
iout = intrlvrOut;
% 64-QAM MODULATION AND MAPPING
hmod =comm.RectangularQAMModulator(64,'BitInput',true);
moutp = step(hmod, iout);
mout = (moutp).';
x = 1;
si = 1;
o = 1;
for snr = 14:0.5:17
for sym = 1:3 % SYMBOL LOOP
data = mout(x:x+3599);
new_sym = zeros(1,3660);
for i = 1:3600
new_sym(i+30) = data(i);
end
p_sym = zeros(1,3780);
d = sort(randint(1, 40, [2 3650])); % random index for central pilot
temp = d;
for i = 1:39
a = d(i+1) - d(i);
if a<5
b =5-a;
d(i+1) = d(i+1) + b;
end
end
pilt = [-1 1 -1]; %BPSK modulated PILOT
for k = 1:40
g = d(k);
for i = 1:g-2;
p_sym(i) = new_sym(i);
end
p_sym(g-1) = -1;
p_sym(g) = 1;
p_sym(g+1) = -1;
for i = g:3660
p_sym(i+2) = new_sym(i);
end
new_sym = p_sym;
end
new_sym = new_sym.'; % SERIAL TO PARALLEL
signal = sqrt(3780) * ifft(new_sym, 3780);
signal = signal.'; % PARALLEL TO SERIAL
% Generating PN-Sequence
load pn_all.mat pn420;
PN420=transpose(pn420(1,);
PN420_MC=sqrt(length(PN420)) * ifft(PN420);
TS = PN420_MC';
z = cxcorr(TS,TS); % For CIRCULAR CORRELATION THEOREM,
% Appending Training Sequence
t_signal = [TS signal]; % SIGNAL TO BE TRANSMITTED
%%
% AWGN channel
%pro = eye(4200) * (t_signal.');
r_signal = awgn(t_signal.', snr, 0);
r_signal = r_signal.';
%%
%TS-based path delay estimation
Tao = 1; %possible paths fro AWGN channel
%%
for i = 1:3780
r_block(i) = r_signal(420+i); % Extracting OFDM Data block
end
trail = fft(r_block.' ,3780)./sqrt(3780);
fft_r_block = trail;
dd = d.';
for n = 1:40
all_pilots(n,1) = dd(n,1)-1;
all_pilots(n,2) = dd(n,1);
all_pilots(n,3) = dd(n,1)+1;
end
cen_plt_index = d;
for i = 1:40
hh = d(i);
cen_plts(i) = fft_r_block(hh); % received central pilots
end
for k = 1:40
g = d(k);
for p_indx = 1:3
trail(g-1) = []; %received data block without pilots
end
end
for i = 1:3600
r_data(i) = trail(i+30); %received data without virtual(/guard) subcarriers
end
%% Path coefficient estimation
for k = 1:40
for n = 0:3779
lem(k,n+1)= 1-(exp(-2j*pi*(n/3780))+exp(2j*pi*(n/3780))); %lemda_i
end
end
for n = 0:3779
thetha(n+1,1) = 1;
thetha(n+1,2) = n; %thetha_n
end
beta = lem*thetha; %beta_i
y_p = cen_plts;
A = ((beta')*beta) + (0.9997 * eye(2)); %noise variance is assumed = 1
B = inv(A);
C = (beta') * (y_p.');
rho_cap = B * C;
h_inl = thetha * rho_cap;
g_i = sum(h_inl)/3780;
G_i = g_i * eye(3780);
%channel equalization: which is ONE-TAP-EQUALIZATION for AWGN channel
x_ik,sym) = r_data.* ( conj(g_i) / ((abs(g_i)^2) + 0.9997) );
end
stream = reshape(x_ik, 1, 10800);
hdmod =comm.RectangularQAMDemodulator(64,'BitOutput',true);
dout = step(hdmod, stream.');
dIntrlv = comm.BlockDeinterleaver(Order);
dintrd = step(dIntrlv,dout);
ddd = fec.ldpcdec(H);
final = decode(ddd,dintrd.');
errors = 0;
be = xor(I,final);
errors = nnz(be);
BER(si,o)=errors/length(I);
o = o+1;
end
si = si+1;
%%
figure
i=14:0.5:17;
semilogy(i,BER);
title('BER vs SNR');
ylabel('BER');
xlabel('SNR (dB)');
grid on