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.

Coopertaive Diversity MATLAB Code

Status
Not open for further replies.

saeddawoud

Full Member level 3
Full Member level 3
Joined
Apr 27, 2007
Messages
153
Helped
6
Reputation
12
Reaction score
1
Trophy points
1,298
Activity points
2,144
Hello,

Does anyone have a MATLAB code for a cooperative diversity communication system with Amplify-and-Forward relaying technique over independent and identically distributed Rayleigh fading channels, where all the nodes are equipped with single antenna?

Thanks in advance
 

I come up with this code, but it does not match the theoritcal results which are obtained from another program. Can anyone tell me why?

Code:
N=10^6;%Number of symbols
b=rand(1,N)>0.5;%Generate Equiprobable Binary Sequence
s=2*b-1;%Convert to Polar: 1->1 and 0->-1
SNRdB=[0:20];%Signal-to-Noise Ratio in dB
for ii=1:length(SNRdB)
    
    n=1/sqrt(2)*(randn(3,N)+j*randn(3,N));%Generate Noise with Zero-Mean and Unity Variance
    h=1/sqrt(2)*(randn(3,N)+j*randn(3,N));%Complex Gaussian Random Variable with zero mean, i.e.:|h| is Rayleigh
    
    y=zeros(2,N);%The Received Matrix at R and D to be Equilized
    hEq=zeros(2,N);%The Equilization Matrix
    
    temp=h(1,:).*s+10^(-SNRdB(ii)/20)*n(1,:);%The Received Signal at the First Hop
    
    y(1,:)=h(3,:).*s+10^(-SNRdB(ii)/20)*n(3,:);%The Received Signal at the Direct Path
    y(2,:)=h(2,:).*(temp./h(1,:))+10^(-SNRdB(ii)/20)*n(2,:);%The Received Signal at the Second Hop
    
    hEq(1,:)=conj(h(3,:));
    hEq(2,:)=conj(h(2,:));
    
    hPower=sum(hEq.*conj(hEq),1);%Channel Power Matrix
    
    yHat=sum(hEq.*y,1)./hPower;
    
    bHat=real(yHat)>0;% The Estimated Binary Sequence
    
    diff=xor(b,bHat);%Compute The XORing Between the Estimated and Origina Binary Sequences 
    nErr(ii)=length(find(diff));%Find the Number of Errors: the Locations of 1s.
    
end

BERSim=nErr/N;
BERTh=[0.160288

0.136645

0.114156

0.0933272

0.0745812

0.0582117

0.0443581

0.0330013

0.0239833

0.0170426

0.0118588

0.00809498

0.00543227

0.00359194

0.00234568

0.00151628

0.000972213

0.00061947

0.000392865

0.000248311

0.000156579]';
close all
figure
semilogy(SNRdB,BERSim,'bp-','LineWidth',2);
hold on
semilogy(SNRdB,BERTh,'ks-','LineWidth',2);
axis([0 20 10^-5 0.5]);
grid on
legend('Simulation','Theoretical')

Thanks in advance
 

Maybe I can help you with programming part.

Tell me what (equation) are you trying to implement and where is it (line number) where you have implemented it in your program.
 

Communications_Engineer said:
Maybe I can help you with programming part.

Tell me what (equation) are you trying to implement and where is it (line number) where you have implemented it in your program.

Hello Communications_Engineer,

I am trying to program the simplest case of Amplify-and-Forward (AF) Channel State Information(CSI)-assisted cooperative diversity system, where we have three nodes: the source S, the relay R, and the destination D. The relay node intended to help the communication between S and D. In the first time slot, S broadcasts a symbol x drawn from BPSK contellation with unity average power. This signal is received by both D and R, and they are, respectively:

\[y_0=h_0\,x+n_0\]
\[y_1=h_1\,x+n_1\]

where \[y_i\], \[h_i\], and \[n_i\] are the received signal, the channel coefficient, and the AWGN over bath \[i\in\{0,1,2\}\], where subscript 0=S-D path, 1=S-R path, 2=R-D path.

In the second time slot, R re-transmits an amplified version of \[y_1\], which is \[x_R=G\,y_1\], where:
\[G=\frac{1}{|h_0|}\]
Then the received signal at D will be:
\[y_2=h_2\,x_R+n_2\]
Now, D has the two signals \[y_0\] and \[y_2\]. It then combines them using MRC combining technique, i.e.:
\[\hat{x}=\frac{h_0^*\,y_0+h_2^*\,y_2}{|h_0|^2+|h_2|^2}\]

These theoritical steps clarified on the code's comments. If there any question, please don't hasitate to ask me.

Regards
 
Last edited by a moderator:

Dear saeed;
this code is used for the conventional diversity teqnique which is called Maximal Ratio combining Technique.

I think cooperative sensing is somehow different from MRC. also i think cooperative diversity needs a transmit diversity nor receiver diversity

Added after 2 minutes:

**broken link removed**

visit this link for MRC, for cooperative diversity you can use google to get some papers on this topic.(also alamouti's scheme wil be useful for you)
 
how can i improve cooperative diversity scheme.it is correct if i used error timing block diagram?
 

Dear saeed;
this code is used for the conventional diversity teqnique which is called Maximal Ratio combining Technique.

I think cooperative sensing is somehow different from MRC. also i think cooperative diversity needs a transmit diversity nor receiver diversity

Added after 2 minutes:

**broken link removed**

visit this link for MRC, for cooperative diversity you can use google to get some papers on this topic.(also alamouti's scheme wil be useful for you)

Thanks for your link, but now, seem link die, please send me other link !
Thanks in advance.

- - - Updated - - -
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top