summaryrefslogtreecommitdiff
path: root/851/CH2/EX2.7/Example2_7.sce
blob: 44fbd1d4b0a6d7cfb31833581759ee5dfac83687 (plain)
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
//clear//
//Caption:Significance of the Channel Coding theorem
//Example2.7: Significance of the channel coding theorem
//Average Probility of Error of Repetition Code
clear;
clc;
close;
p =10^-2;
pe_1 =p; //Average Probility of error for code rate r = 1
pe_3 = 3*p^2*(1-p)+p^3;//probility of error for code rate r =1/3
pe_5 = 10*p^3*(1-p)^2+5*p^4*(1-p)+p^5;//error for code rate r =1/5
pe_7 = ((7*6*5)/(1*2*3))*p^4*(1-p)^3+(42/2)*p^5*(1-p)^2+7*p^6*(1-p)+p^7;//error for code rate r =1/7
r = [1,1/3,1/5,1/7];
pe = [pe_1,pe_3,pe_5,pe_7];
a=gca();
a.data_bounds=[0,0;1,0.01];
plot2d(r,pe,5)
xlabel('Code rate, r')
ylabel('Average Probability of error, Pe')
title('Figure 2.12 Illustrating significance of the channel coding theorem')
legend('Repetition codes')
xgrid(1)
disp('Table 2.3 Average Probility of Error for Repetition Code')
disp('_______________________________________________________________')
disp(r,'Code Rate, r =1/n',pe,'Average Probility of Error, Pe')
disp('_______________________________________________________________')