summaryrefslogtreecommitdiff
path: root/1574/CH15/EX15.1/BIT_Ex_15_1.sce
diff options
context:
space:
mode:
Diffstat (limited to '1574/CH15/EX15.1/BIT_Ex_15_1.sce')
-rwxr-xr-x1574/CH15/EX15.1/BIT_Ex_15_1.sce10
1 files changed, 10 insertions, 0 deletions
diff --git a/1574/CH15/EX15.1/BIT_Ex_15_1.sce b/1574/CH15/EX15.1/BIT_Ex_15_1.sce
new file mode 100755
index 000000000..9a60b6e55
--- /dev/null
+++ b/1574/CH15/EX15.1/BIT_Ex_15_1.sce
@@ -0,0 +1,10 @@
+clc
+//Chapter15
+//Example15.1, page no 533
+//Given
+P_A=0.5// probability of producing symbol 'A'
+P_B=0.25// probability of producing symbol 'B'
+P_C=0.25// probability of producing symbol 'C'
+H=P_A*log2(1/P_A)+P_B*log2(1/P_B)+P_C*log2(1/P_C)// the source entropy
+mprintf('The source entropy is: %f bits/symbol',H)
+