You are on page 1of 3

Lab-4

Objective: To analyze BER performance of 2x1TB MISO using BPSK signal.


%% LAB 4 MISO
clc;
clear all;
close all;
format long;
N=10000;
f=sqrt(0.5);
index=1;
a=1; %correlation coefficient
for k=1:2:25
x=10^(k/10);
xa=sqrt(x/(x+1));
p=sqrt(1/x); %noise power
bera(index)=((1-a^2)*(1-xa)/2)+ (a^2*(2-3*xa+xa^3)/4);
data=randint(1,N);
x=(2*data-1);
h_1=f*(randn(1,N)+(j*randn(1,N))); % perfect channel h1
h_2=f*(randn(1,N)+(j*randn(1,N))); % perfect channel h2
h1=(a*h_1)+(sqrt(1-a*a)*f*(randn(1,N)+(j*randn(1,N)))); % imperfect channel h1
h2=(a*h_2)+(sqrt(1-a*a)*f*(randn(1,N)+(j*randn(1,N)))); % imperfect channel h2
n=f*(randn(1,N)+(j*randn(1,N)));
for kk=1:N
h_imperfect=[h1(kk) ; h2(kk)];
w=h_imperfect/sqrt(h_imperfect'*h_imperfect);
hperfect=[h_1(kk) ; h_2(kk)];
y=(w'*hperfect*x(kk))+(p*n(kk));
d=(w'*hperfect)'*y;
if(real(d >=0))
data_detect(kk)=1;
else
data_detect(kk)=0;
end
end
error=xor(data,data_detect);
bers(index)=sum(error)/N;

snr(index)=k;
[snr(index) bera(index) bers(index)];
index=index+1;
end
semilogy(snr,bera,snr,bers)
legend('Analytical','Simulation')
xlabel('SNR dB');
ylabel('BER')
Output:

a=1

a=0.8

a=0.9

a=0.5

You might also like