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.

Need help for AF simulation in rayleigh channel

Status
Not open for further replies.

outman

Newbie level 4
Joined
Aug 14, 2010
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,337
Hi, everyone, I want to compute the BER/SER of the AF relay protocol in rayleigh channel with QPSK. But i don't get the rigth result. the codes are the following:

mode=4; % QPSK;
SNRdB =0:2:40; % SNR(dB)
NumBits=1e6; % number of total bits
BPS=log2(mode); % bit per symbol
data=randint(1,NumBits); % datas
Txsig=pskmod(data,mode); % % QPSK modulation
%===========================================
for i =1:length(SNRdB)

SNR=10.^(SNRdB(i)/10);
% CN-(0,1)
N_sd=(randn(1,NumBits)+j*randn(1,NumBits))/sqrt(2)*10.^(-SNRdB(i)/20);
N_sr=(randn(1,NumBits)+j*randn(1,NumBits))/sqrt(2)*10.^(-SNRdB(i)/20);
N_rd=(randn(1,NumBits)+j*randn(1,NumBits))/sqrt(2)*10.^(-SNRdB(i)/20);
% %==================================================

% rayleigh channel is it rigth???
chan_sd=1/sqrt(2)*(randn(1,length(Txsig))+j*randn(1,length(Txsig))); % s-d channel
chan_sr=1/sqrt(2)*(randn(1,length(Txsig))+j*randn(1,length(Txsig))); % s-r channel

chan_rd=1/sqrt(2)*(randn(1,length(Txsig))+j*randn(1,length(Txsig)) ); % r-d channel


Ysr=chan_sr.*Txsig+ N_sr; %
belta=sqrt(SNR)./(sqrt(SNR.*abs(chan_sr).^2)+1);
Y=Ysr.*belta; %
Ysd=chan_sd.*Txsig+ N_sd;
Yrd=chan_rd.*Y+ N_rd; %

% MRC
a1=conj(chan_sd);
a2=(conj(chan_sr).*belta.*conj(chan_rd))./(belta.^2.*abs(chan_sr).^2+1);
MRC=Ysd.*a1+Yrd.*a2; %

% QPSK demodulation
Rx_sd=pskdemod(Ysd,mode);
Rx_Mrc=pskdemod(MRC,mode);

% BER
[bitsd,bersd(i)]=biterr(data,Rx_sd); % compute the BER of the S-D link
[bitrd,bermrc(i)]=biterr(data,Rx_Mrc); % compute the BER of the S-R-D link
end
% ======================

% Pe1=berfading(SNRdB,'psk',mode,1); % compute the theoretical BER of the S-D link
% Pe2=berfading(SNRdB,'psk',mode,2); % compute the theoretical BER of the S-R-D link

%%=========================================
I want to know is the code rigth? After the simulation, the simulation curve can not coincide with the theoretical curve .But I can not find where the problem is. Please give me some help. Thank u!!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top