# Outage Probability Simulation for Rayleigh fading channel

Status
Not open for further replies.

#### FunnyCastiel

##### Newbie level 4
Hi,
Can someone tell me how to simulate Outage Probability for a Rayleigh fading channel ?
I have plotted the graph in Matlab , using theoretical formulations, but I don't know how to simulate it to compare with the theoretical graph.

Thanks a lot

#### wave1

##### Junior Member level 2
Outage is defined as events where the receiver cannot fulfill the required performance. So first you have to decide what is considered outage events - for example, you can define BER = 10E-4 is the minimum BER your system can handle.
and all below it (i.e. BER = 10E-3) is a failure.

assuming your channel is slow-fading Rayleigh channel, you need to randomize a random variable for the channel gain. Then pass a long enough block of symbols through this gain.
Then measure the BER. if it is below your threshold, the whole block fails and you declare outage.
Do this for enough blocks, count the number of blocks that failed, and you have the outage probability curve .

Points: 2

### xdwangkp

Points: 2

#### FunnyCastiel

##### Newbie level 4
Thank wave1
I tried the folowing code

snr_db= [0:30]
nr_of_bits = 2^8;
iterations = 2000;
snr_linear = 10.^(snr_db/10);

BERthreshold=1e-4 ; SNRthreshold=55.3536;
Outage=[];theory=[];
BER = zeros(1,size(snr_db,2));

for iSNR =1:size(snr_db,2)

sigma=sqrt(1/(2*snr_linear(iSNR)));
errorblock=0; % the number of bad-quality block
for i=1:iterations %

transmit_bit =round(rand(1,nr_of_bits))*2-1;
h = 1/sqrt(2)*complex(randn(1,nr_of_bits),randn(1,nr_of_bits));
noise = [randn(1,nr_of_bits)+1j*randn(1,nr_of_bits)]*sigma;
received_bits = h.* transmit_bit + noise;
estmtd_h = conj(h);
nr_of_errors= sum(not(detected_bits == transmit_bit)); %Find number of errors in this block
blockBER=nr_of_errors/nr_of_bits; %BER of this block
if (blockBER > BERthreshold) errorblock=errorblock+1;
else errorblock=errorblock; end

end

Ratioerrorblock=errorblock/iterations;
Outage=[Outage Ratioerrorblock];

%Now, calculate the theoretical Outage Prob

theoryOut=1 - exp(-SNRthreshold/snr_linear(iSNR));
theory=[theory theoryOut];

end
plot(snr_db,Outage,'*',snr_db,theỏy)
ylabel('Outage Probability');
xlabel('SNR (dB)');
grid

But each time i change the argument "number of bits", the graph change dramatically.

Do you have another sample code for this?

Last edited:

#### wave1

##### Junior Member level 2
1. first of all i see you randomize a channel vector for each block. that is relating to situation where you assume your channel
is either fast fading, or you have perfect interleaving. there's nothing wrong with it, just make sure this is what you assume.
2. why are generating only 2^8 bits in each block? remember you are looking for BER at orders of 1E-4, but you won't find this in this way, and the calculation errors for trying to measure the BER in this kind of block can be quite large. I *assume* this is the reason for the deviation when you change nr_of_bits.
try to run on smaller SNR range to make it faster, and with large blocks at each iteration.
3. can you explain
theoryOut=1 - exp(-SNRthreshold/snr_linear(iSNR));
?

#### FunnyCastiel

##### Newbie level 4
I think it's the CDF of SNR distribution at the value "SNR threshold" for a Rayleign fading channel (i.e. the theoretical outage probability).
${F_\gamma }(x) =1 - {e}^{\frac{-x}{\bar{\gamma }}}$
is there something wrong with it ?

Last edited:

#### wave1

##### Junior Member level 2
ah, okay it's the CDF of exponentially distributed RV.

#### lapolm

##### Newbie level 5
FunnyCastiel, I wonder how did u select SNRthreshold and BERthreshold ? Because they must be selected dependently. I mean Outage probability is the CDF of the PDF of SNR. So if u select SNR threshold as 3dB your outage probability (theory) should be integrated at 3 dB.

#### blue_orchid

##### Newbie level 4
dear anyone
could you tell me how to simulate Outage Probability for multi relay network with Rayleigh fading channel ?
pelase, help me

Status
Not open for further replies.