summaryrefslogtreecommitdiff
path: root/2606/CH6/EX6.20/ex6_20.sce
diff options
context:
space:
mode:
Diffstat (limited to '2606/CH6/EX6.20/ex6_20.sce')
-rwxr-xr-x2606/CH6/EX6.20/ex6_20.sce28
1 files changed, 28 insertions, 0 deletions
diff --git a/2606/CH6/EX6.20/ex6_20.sce b/2606/CH6/EX6.20/ex6_20.sce
new file mode 100755
index 000000000..78132ef6c
--- /dev/null
+++ b/2606/CH6/EX6.20/ex6_20.sce
@@ -0,0 +1,28 @@
+//Page Number: 6.23
+//Example 6.20
+clc;
+//Given
+pe=0.01; //Error probability
+
+//(a) Probabilty of more than one error in 10 recieved digits
+n=10;
+//As P(X>1)=1-P(X=0)-P(X=1)
+//Let x=P(X>1)
+//s=P(X=0)+P(X=1)
+s=0;
+for t=0:1
+ f=(factorial(n))/((factorial(t))*(factorial(n-t)));
+ s=s+{f*(pe^t)*((1-pe)^(n-t))};
+end
+x=1-s;
+disp(x,'Probabilty of more than one error in 10 recieved digits:');
+
+//(b)Using Poisson approximation
+//P(X=k)~[{(%exp)^(-n*p)}*{((n*p)^k)}]/k factorial
+s1=0;
+for k=0:1
+ j=factorial(k);
+ s1=s1+[{exp(-n*pe)}*{((n*pe)^k)}]/j;
+end
+x1=1-s1;
+disp(x1,'Using Poisson Approximation:');