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

Awgn 16qam

Uploaded by

Kübra Gökalp
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)
2 views6 pages

Awgn 16qam

Uploaded by

Kübra Gökalp
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/ 6

ERZURUM TEKNİK ÜNİVERSİTESİ

MÜHENDİSLİK FAKÜLTESİ

ELEKTRİK VE ELEKTRONİK MÜHENDİLİSLİĞİ

YÜKSEK LİSANS ÖDEV

Prof. Dr. Birol Soysal

İLERİ SAYISAL HABERLEŞME

KEVSER KÜBRA GÖKALP

240652004

2024

ERZURUM

clear all;clc;
% format long;
NSYM=1000;sigma=50;%gain=1;

for k=1:NSYM;
r1=randi(2,1)-1;
r2=randi(2,1)-1;
r3=randi(2,1)-1;
r4=randi(2,1)-1;
if (r1==1 && r2==1 && r3==1 && r4==1)
data1(k)=complex(1,1);
end
if (r1==1 && r2==1 && r3==0 && r4==1)
data1(k)=complex(-1,1);
end
if (r1==0 && r2==1 && r3==0 && r4==1)
data1(k)=complex(-1,-1);
end
if (r1==0 && r2==1 && r3==1 && r4==1)
data1(k)=complex(1,-1);
end
if (r1==1 && r2==0 && r3==1 && r4==1)
data1(k)=complex(1,3);
end
if (r1==1 && r2==0 && r3==0 && r4==1)
data1(k)=complex(-1,3);
end
if (r1==1 && r2==0 && r3==0 && r4==0)
data1(k)=complex(-3,3);
end
if (r1==1 && r2==1 && r3==0 && r4==0)
data1(k)=complex(-3,1);
end
if (r1==0 && r2==1 && r3==0 && r4==0)
data1(k)=complex(-3,-1);
end
if (r1==0 && r2==0 && r3==0 && r4==0)
data1(k)=complex(-3,-3);
end
if (r1==0 && r2==0 && r3==0 && r4==1)
data1(k)=complex(-1,-3);
end
if (r1==0 && r2==0 && r3==1 && r4==1)
data1(k)=complex(1,-3);
end
if (r1==0 && r2==0 && r3==1 && r4==0)
data1(k)=complex(3,-3);
end
if (r1==0 && r2==1 && r3==1 && r4==0)
data1(k)=complex(3,-1);
end
if (r1==1 && r2==1 && r3==1 && r4==0)
data1(k)=complex(3,1);
end
if (r1==1 && r2==0 && r3==1 && r4==0)
data1(k)=complex(3,3);
end
Tx_data(k,:)=[r1 r2 r3 r4];
end
for g=1:20 % SNR Dongusu
g
svk=0;snk=0;hata=0;
for kl=1:1 % Kanal Dongusu

for k=1:NSYM % Sembol Dongusu

v(k)=data1(k);
R=sqrt(-2*sigma*log(rand))/(sqrt(2))^g;
U=2*pi*rand();
nu=complex((R*cos(U)),(R*sin(U)));
svk=svk+v(k)*conj(v(k));
snk=snk+nu*conj(nu);
v(k)=v(k)+nu;
xu(k)=v(k);

if (real(xu(k)) > 2 && imag(xu(k)) > 2)

Rx_data(k,:)=[1 0 1 0];
end
if (real(xu(k)) > 0 && real(xu(k)) < 2 &&
imag(xu(k)) > 2)

Rx_data(k,:)=[1 0 1 1];
end
if (real(xu(k)) > -2 && real(xu(k)) < 0
&& imag(xu(k)) > 2)
Rx_data(k,:)=[1 0 0 1];
end
if (real(xu(k)) < -2 && imag(xu(k)) > 2)

Rx_data(k,:)=[1 0 0 0];
end
if (real(xu(k)) > 2 && imag(xu(k)) > 0
&& imag(xu(k)) < 2)

Rx_data(k,:)=[1 1 1 0];
end
if (real(xu(k)) > 0 && real(xu(k)) < 2
&& imag(xu(k)) > 0 && imag(xu(k)) < 2)

Rx_data(k,:)=[1 1 1 1];
end
if (real(xu(k)) > -2 && real(xu(k)) < 0
&& imag(xu(k)) > 0 && imag(xu(k)) < 2)

Rx_data(k,:)=[1 1 0 1];
end
if (real(xu(k)) < -2 && imag(xu(k)) > 0
&& imag(xu(k)) < 2)

Rx_data(k,:)=[1 1 0 0];
end
if (real(xu(k)) > 2 && imag(xu(k)) > -2
&& imag(xu(k)) < 0)

Rx_data(k,:)=[0 1 1 0];
end
if (real(xu(k)) > 0 && real(xu(k)) < 2 &&
imag(xu(k)) > -2 && imag(xu(k)) < 0)

Rx_data(k,:)=[0 1 1 1];
end
if (real(xu(k)) > -2 && real(xu(k)) < 0
&& imag(xu(k)) > -2 && imag(xu(k)) < 0)

Rx_data(k,:)=[0 1 0 1];
end
if ( real(xu(k)) < -2 && imag(xu(k)) > -2
&& imag(xu(k)) < 0)
Rx_data(k,:)=[0 1 0 0];
end
if ( real(xu(k)) > 2 && imag(xu(k)) < -2)

Rx_data(k,:)=[0 0 1 0];
end
if ( real(xu(k)) > 0 && real(xu(k)) < 2
&& imag(xu(k)) < -2)

Rx_data(k,:)=[0 0 1 1];
end
if (real(xu(k)) > -2 && real(xu(k)) < 0
&& imag(xu(k)) < -2)

Rx_data(k,:)=[0 0 0 1];
end
if (real(xu(k)) < -2 && imag(xu(k)) < -
2)

Rx_data(k,:)=[0 0 0 0];
end

hata=hata+sum(Tx_data(k,:)~=Rx_data(k,:));
end
end
SNR(g)=10*log10(svk/snk);
BER(g)=hata/(4*kl*(NSYM));
svk=0.;snk=0.;hata=0.;
end
semilogy(SNR,BER);grid;

You might also like