summaryrefslogtreecommitdiff
path: root/3871/CH14/EX14.2/Ex14_2.sce
diff options
context:
space:
mode:
authorprashantsinalkar2018-02-03 11:01:52 +0530
committerprashantsinalkar2018-02-03 11:01:52 +0530
commit7bc77cb1ed33745c720952c92b3b2747c5cbf2df (patch)
tree449d555969bfd7befe906877abab098c6e63a0e8 /3871/CH14/EX14.2/Ex14_2.sce
parentd1e070fe2d77c8e7f6ba4b0c57b1b42e26349059 (diff)
downloadScilab-TBC-Uploads-7bc77cb1ed33745c720952c92b3b2747c5cbf2df.tar.gz
Scilab-TBC-Uploads-7bc77cb1ed33745c720952c92b3b2747c5cbf2df.tar.bz2
Scilab-TBC-Uploads-7bc77cb1ed33745c720952c92b3b2747c5cbf2df.zip
Added new codeHEADmaster
Diffstat (limited to '3871/CH14/EX14.2/Ex14_2.sce')
-rw-r--r--3871/CH14/EX14.2/Ex14_2.sce29
1 files changed, 29 insertions, 0 deletions
diff --git a/3871/CH14/EX14.2/Ex14_2.sce b/3871/CH14/EX14.2/Ex14_2.sce
new file mode 100644
index 000000000..abae991ad
--- /dev/null
+++ b/3871/CH14/EX14.2/Ex14_2.sce
@@ -0,0 +1,29 @@
+//===================================================================================
+//Chapter 14 example 2
+
+clc;
+clear all;
+
+//variable declaration
+D = 16; //output voltage in V
+
+//calculations
+Dn1 = D/(2^1); //first MSB output in V
+Dn2 = D/(2^2); //second MSB output in V
+Dn3 = D/(2^3); //third MSB output in V
+Dn4 = D/(2^4); //fourth MSB output in V
+Dn5 = D/(2^5); //fifth MSB output in V
+Dn6 = D/(2^6); //Sixth MSB output in V
+V = Dn1+Dn2+Dn3+Dn4+Dn5+Dn6;
+Vout = ((D*(2^0))+(D*(2^1))+(0*(2^2))+(D*(2^3))+(0*(2^4))+(D*(2^5)))/(2^6); //for digital input 101011
+
+//result
+mprintf(" first MSB output = %3.2f V",Dn1);
+mprintf("\n second MSB output = %3.2f V",Dn2);
+mprintf("\n third MSB output = %3.2f V",Dn3);
+mprintf("\n fourth MSB output = %3.2f V",Dn4);
+mprintf("\n fifth MSB output = %3.2f V",Dn5);
+mprintf("\n Sixth MSB output = %3.2f V",Dn6);
+mprintf("\nthe resolution is equal to the weight of the LSB = %3.2f V",Dn6);
+mprintf("\nthe full scale output for digital input of 101011 =%3.2f V",V);
+mprintf("\nthe voltage output for a digital input of 101011 = %3.2f V",Vout);