summaryrefslogtreecommitdiff
path: root/1895/CH11/EX11.17
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /1895/CH11/EX11.17
downloadScilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip
initial commit / add all books
Diffstat (limited to '1895/CH11/EX11.17')
-rwxr-xr-x1895/CH11/EX11.17/EXAMPLE11_17.SCE21
1 files changed, 21 insertions, 0 deletions
diff --git a/1895/CH11/EX11.17/EXAMPLE11_17.SCE b/1895/CH11/EX11.17/EXAMPLE11_17.SCE
new file mode 100755
index 000000000..64d2074f0
--- /dev/null
+++ b/1895/CH11/EX11.17/EXAMPLE11_17.SCE
@@ -0,0 +1,21 @@
+//ANALOG AND DIGITAL COMMUNICATION
+//BY Dr.SANJAY SHARMA
+//CHAPTER 11
+//Information Theory
+clear all;
+clc;
+printf("EXAMPLE 11.17(PAGENO 498)");
+//given
+Px_1 = 1/2;//probability of first symbol
+Px_2 = 1/4;//probability of second symbol
+Px_3 = 1/8;//probability of third symbol
+Px_4 = 1/16;//probability of fourth symbol
+Px_5 = 1/16;//probability of fifth symbol
+r = 16//outcomes per second
+
+//calculations
+H_X = Px_1*log2(1/Px_1) + Px_2*log2(1/Px_2) + Px_3*log2(1/Px_3) + Px_4*log2(1/Px_4) + Px_5*log2(1/Px_5);
+R = r*H_X;//information rate
+
+//result
+printf("\n\nRate of information = %.2f bits/sec",R);