summaryrefslogtreecommitdiff
path: root/1895/CH11/EX11.49
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.49
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.49')
-rwxr-xr-x1895/CH11/EX11.49/EXAMPLE11_49.SCE27
1 files changed, 27 insertions, 0 deletions
diff --git a/1895/CH11/EX11.49/EXAMPLE11_49.SCE b/1895/CH11/EX11.49/EXAMPLE11_49.SCE
new file mode 100755
index 000000000..ab3e90257
--- /dev/null
+++ b/1895/CH11/EX11.49/EXAMPLE11_49.SCE
@@ -0,0 +1,27 @@
+//ANALOG AND DIGITAL COMMUNICATION
+//BY Dr.SANJAY SHARMA
+//CHAPTER 11
+//Information Theory
+clear all;
+clc;
+printf("EXAMPLE 11.49(PAGENO 534)");
+
+//given
+P_x1 = .4//probability of first signal
+P_x2 = .2//probability of second signal
+P_x3 = .8//probability of third signal
+P_x4 = .08//probability of fourth signal
+P_x5 = .02//probability of fifth signal
+n1 = 2//number of bits in code obtained from table given textbook
+n2 = 3//number of bits in code obtained from table given textbook
+n3 = 1//number of bits in code obtained from table given textbook
+n4 = 4//number of bits in code obtained from table given textbook
+n5 = 4//number of bits in code obtained from table given textbook
+
+//calculations
+L = P_x1*n1 + P_x2*n2 + P_x3*n3 + P_x4*n4 + P_x5*n5;//average codeword length per symbol
+//since sigma = sqrt(summation of product of probability and (n- L)^2)
+sigmasquare = P_x1*(n1-L)^2 + P_x2*(n2-L)^2 +P_x3*(n3-L)^2 + P_x4*(n4-L)^2 +P_x5*(n5-L)^2;//Variance of codewoed length
+
+//results
+printf("\n\nVariance of codeword length =%.4f",sigmasquare)