robintane
Junior Member level 1
- Joined
- Nov 10, 2012
- Messages
- 15
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 1,283
- Activity points
- 1,375
What is the relaying mode of the relays?
Do you know how to do simulation for two hops?
clear all;
clc;
SNRdB=0:20;
SNR=10.^(SNRdB./10);
N=10;%Number of outages to find at each SNR point
ythdB=0;% Threshold in dB
yth=10.^(ythdB./10);
Out1=zeros(length(SNR),1);
Count1=zeros(length(SNR),1);
Out2=zeros(length(SNR),1);
Count2=zeros(length(SNR),1);
for ii=1:length(SNR)
while Out1(ii)<=N || Out2(ii)<=N
Count1(ii)=Count1(ii)+1;
Count2(ii)=Count2(ii)+1;
y1=exprnd(SNR(ii),1,1);%SNR of the first hop
y2=exprnd(SNR(ii),1,1);%SNR of the second hop
y0=exprnd(SNR(ii),1,1);%SNR of the direct link
yeq1=y0+(y1*y2/(y1+y2+1));%Equivalent SNR in the presence of direct link with MRC at D
yeq2=(y1*y2/(y1+y2+1));% Equivalent SNR in the absence of direct link
if yeq1<=yth
Out1(ii)=Out1(ii)+1;
end
if yeq2<=yth
Out2(ii)=Out2(ii)+1;
end
end
end
semilogy(SNRdB,Out1./Count1,SNRdB,Out2./Count2)
axis([0 20 10^-5 1])
legend('With Direct Link','Without Direct Link')
Outage is defined as following: the instantaneous SNR drops below a certain threshold. So, you need two things: the instantaneous SNR and the threshold. The threshold is predetermined, say 0 dB. Now you need to find the instantaneous SNR, which in your case will be the equivalent SNR of all hops. I do not remember it, but in the literature you can find the formula of the equivalent SNR of a multihop relaying system in terms of the SNR of individual hops. So, now all you need to do is to generate the individual hops' SNRs. For example, in case of Rayleigh fading, the instantaneous per hop SNR is exponentially distributed. So, generate L (number of hops) exponential random variables, and substitute them in the equivalent SNR. Then compare the equivalent SNR with the threshold. Repeat this process for a number of iterations to get smooth curve. For example for the case of two hops I would write the following code
y=exprnd(SNR(ii),N,1)
Outage is defined as following: the instantaneous SNR drops below a certain threshold. So, you need two things: the instantaneous SNR and the threshold. The threshold is predetermined, say 0 dB. Now you need to find the instantaneous SNR, which in your case will be the equivalent SNR of all hops. I do not remember it, but in the literature you can find the formula of the equivalent SNR of a multihop relaying system in terms of the SNR of individual hops. So, now all you need to do is to generate the individual hops' SNRs. For example, in case of Rayleigh fading, the instantaneous per hop SNR is exponentially distributed. So, generate L (number of hops) exponential random variables, and substitute them in the equivalent SNR. Then compare the equivalent SNR with the threshold. Repeat this process for a number of iterations to get smooth curve. For example for the case of two hops I would write the following code
Code:clear all; clc; SNRdB=0:20; SNR=10.^(SNRdB./10); N=10;%Number of outages to find at each SNR point ythdB=0;% Threshold in dB yth=10.^(ythdB./10); Out1=zeros(length(SNR),1); Count1=zeros(length(SNR),1); Out2=zeros(length(SNR),1); Count2=zeros(length(SNR),1); for ii=1:length(SNR) while Out1(ii)<=N || Out2(ii)<=N Count1(ii)=Count1(ii)+1; Count2(ii)=Count2(ii)+1; y1=exprnd(SNR(ii),1,1);%SNR of the first hop y2=exprnd(SNR(ii),1,1);%SNR of the second hop y0=exprnd(SNR(ii),1,1);%SNR of the direct link yeq1=y0+(y1*y2/(y1+y2+1));%Equivalent SNR in the presence of direct link with MRC at D yeq2=(y1*y2/(y1+y2+1));% Equivalent SNR in the absence of direct link if yeq1<=yth Out1(ii)=Out1(ii)+1; end if yeq2<=yth Out2(ii)=Out2(ii)+1; end end end semilogy(SNRdB,Out1./Count1,SNRdB,Out2./Count2) axis([0 20 10^-5 1]) legend('With Direct Link','Without Direct Link')
Usually, if you you have multiple relays in series, it is called multihop. If you have relays in parallel it is called multi-branch dual hop system. Just to set the terminology.
Do you know the math behind the curves? What kind of receiver was used? MRC or selection combining (SC)? If you know the mathematical equations, having the example I provided, it is easy to do.
I prefer to write down your own code, and discuss it, instead of asking me to "help you", expecting me to give you the code ready.
You have the equivalent SNR as in (1). You just have the summation that is different than the one relay case. All you have to do is to generate different independent equivalent SNR per relay as in the code I gave you, and sum them up with the SNR of the direct link to get the overall equivalent SNR. It is straightforward.
Yes, I know
I can simulate BER for 1 hop, two hops, ...
But I don't know how to simulate Outage Probability for 1 hop , 2 hops .... Can you help me this problem
Can you talk with me via gmail chat : nguyenkimhieuha
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?