Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Can anyone help me verify the code for maximal ratio combining for 3 receivers

Status
Not open for further replies.

Sneha Reddy

Newbie level 1
Newbie level 1
Joined
Feb 15, 2013
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,291
clc;
clear all;
close all;
nr=3;ns=10;
M=2;Es=10;
k=log2(M);
SNR=[4:4:20];
for i=1:length(SNR)
count=0;
msg_symbol=randint(ns,1);
b=length(msg_symbol);
N=length(msg_symbol)/k;
l=reshape(msg_symbol,N,k);
xsym=bi2de(l,'left-msb');%binary to decimal conversion(symbol converison)
x=pskmod(xsym,M);
N0=((4*Es)/10^(SNR(i)/10));
h = randn(ns,nr)+1j*randn(ns,nr);%
Z =sqrt(N0/2)*(randn(ns,nr)+i*randn(ns,nr));

y1:),1)=(x.*h:),1))+Z:),1);
y1:),2)=(x.*h:),2))+Z:),2);
y1:),3)=(x.*h:),3))+Z:),3);

w:),1)=(h:),1))/norm(h);
w:),2)=(h:),2))/norm(h);
w:),3)=(h:),3))/norm(h);

yf1=w'.*transpose(y1);
y=sum(yf1);
k1=pskdemod(y,M);%PSK demodulation
rec_bits=de2bi(k1,'left-msb',k);% symbol to bit mapping
z1=reshape(rec_bits,(N*k),1);
count=count+sum(abs(msg_symbol-z1));

B_err(i)=count/(ns);
end



semilogy(SNR,B_err);
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top