-
Notifications
You must be signed in to change notification settings - Fork 8
/
main.m
34 lines (26 loc) · 811 Bytes
/
main.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
% Example script which plots the block error probability as function of
% rate.
clear;
clc;
% Configuration
N = 256;
p_erasure = 0.4;
num_simulations_per_rate = 200;
num_rates_simulated = 100;
rates = linspace(1/4, 1 - p_erasure, num_rates_simulated);
success_rates = zeros(1, num_rates_simulated);
for i = 1:num_rates_simulated
count = 0;
rate = rates(i);
for j = 1:num_simulations_per_rate
count = count + simulate(N, rate, p_erasure);
end
success_rates(i) = count / num_simulations_per_rate;
end
clc;
figure % opens new figure window
block_error_probabilites = 1 - success_rates;
semilogy(rates, block_error_probabilites, '-o','MarkerIndices', 1:num_rates_simulated)
title('Block error probability as a function of rate')
ylabel('Block error probability')
xlabel('Rate')