wireless communication system simulation

6 visualizaciones (últimos 30 días)
charu shree
charu shree el 10 de Mayo de 2020
Hello all, I had implemented a optimal detector algorithm in matlab. The complete program is running but the bit error rate curve is not coming properly. The bit error rates values should go on decreasing but in my case it decreases at start and later increases. I am attaching the code developed by me along with the algorithm. Any help in this regard would be highly appreciated.
clc;
clear all;
close all;
% Initialization
Nw = 1; % noise variance
M = 50 ; % symbol period of the tag
Mt = 4; % training symbols
al = 0.5 ; % alpha is tag coefficient
L = 1000;
N_mc = 10^6;
N = 50; % comsecutive samples of s(n)
RCD = 0.5;% Relative channel difference.
SNRdB = 0:5:20;
%%% initialisation complete%%%%%%%%%%%%
% Radio frequency source transmitting signal s(n)
sn = sqrt(1/2)*(randn(1,L)+1i*randn(1,L));
Ps = 1; % RF source signal power
% channels and AWGN noise
hsr = sqrt(1/2)*(randn(1,L)+1i*randn(1,L)); % channel between source and reader
hst = sqrt(1/2)*(randn(1,L)+1i*randn(1,L));% channel between source and tag
vn = 10;
htr = sqrt(vn/2)*(randn(1,L)+1i*randn(1,L)); % channel between tag and reader
wn = sqrt(1/2)*(randn(1,L)+1i*randn(1,L)); % AWGN noise
% Thresholds
ho = hsr;
ho_abs = sqrt(sum(abs(ho).^2));
so2 = (((ho_abs)^2)*Ps)+Nw;% sigma_o square
h1 = (hsr)+ (al*(hst.*htr));
h1_abs = sqrt(sum(abs(h1).^2));
s12 = (((h1_abs)^2)*Ps)+Nw; % sigma_1 square
Nid = 10^2 ;% number of incorrect bit decisions
% Reader / receiver
for n = 1:length (SNRdB)
errcnt = 0;
bitcnt = 0;
while errcnt < Nid
d = (rand > 1/2); % tag
if d == 0
y = ((hsr + al*(hst.*htr)*d).*sn)+ 10^(-SNRdB(n)/20)* wn;
ybar = y(1:N);
z = norm(ybar);
Z = z^2;
end
if d == 1
y = ((hsr + al*(hst.*htr)*d).*sn)+ 10^(-SNRdB(n)/20)* wn;
ybar = y(1:N);
z = norm(ybar);
Z = z^2;
end
ho = hsr;
ho_abs = sqrt(sum(abs(ho).^2));
so2 = (((ho_abs)^2)*Ps)+Nw;% sigmao square
h1 = (hsr)+ (al*(hst.*htr));
h1_abs = sqrt(sum(abs(h1).^2));
s12 = (((h1_abs)^2)*Ps)+Nw; % sigma1 square
ThCG = ((N*so2*s12)/(s12-so2))*log(s12/so2); % threshold for complex gaussian optimal detector.
if so2 > s12
if Z > ThCG
dhat = 0;
else
dhat = 1;
end
end
if so2 < s12
if Z < ThCG
dhat = 0;
else
dhat = 1;
end
end
if dhat ~= d
errcnt = errcnt+1;
end
bitcnt = bitcnt+1;
end
BER(n) = errcnt/bitcnt;
end
figure
semilogy(SNRdB,BER);
grid on;
xlabel('SNRdB');
ylabel('Bit Error Rate');

Respuestas (0)

Categorías

Más información sobre Sources and Sinks en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by