summaryrefslogtreecommitdiff
path: root/3554/CH17
diff options
context:
space:
mode:
authorprashantsinalkar2017-10-10 12:27:19 +0530
committerprashantsinalkar2017-10-10 12:27:19 +0530
commit7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 (patch)
treedbb9e3ddb5fc829e7c5c7e6be99b2c4ba356132c /3554/CH17
parentb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (diff)
downloadScilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.gz
Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.bz2
Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.zip
initial commit / add all books
Diffstat (limited to '3554/CH17')
-rw-r--r--3554/CH17/EX17.1/Ex17_1.sce31
-rw-r--r--3554/CH17/EX17.2/Ex17_2.sce20
-rw-r--r--3554/CH17/EX17.3/Ex17_3.sce18
-rw-r--r--3554/CH17/EX17.4/Ex17_4.sce22
4 files changed, 91 insertions, 0 deletions
diff --git a/3554/CH17/EX17.1/Ex17_1.sce b/3554/CH17/EX17.1/Ex17_1.sce
new file mode 100644
index 000000000..554f1d687
--- /dev/null
+++ b/3554/CH17/EX17.1/Ex17_1.sce
@@ -0,0 +1,31 @@
+// Exa 17.1
+
+clc;
+clear all;
+
+// Given data
+// A 5 bit resistive divider
+
+n=5;// since 5 bit resistive divider
+Ip1=[1 1 0 1 1];// Digital input 1(1st element of array is MSB)
+Ip2=[1 0 1 1 0];//Digital input 2(1st element of array is MSB)
+V1=10;// Voltage corresponding to binary 1
+V0=0;// Voltage corresponding to binary 0
+
+// Solution
+
+LSB_weight=1/(2^n - 1);
+printf('The LSB weight = %.4f \n ',LSB_weight);
+LSB2_weight=2^(2-1)/(2^n-1);
+printf('The 2nd LSB weight = %.4f \n ',LSB2_weight');
+LSB3_weight=2^(3-1)/(2^n-1);
+printf('The 3rd LSB weight = %.4f \n ',LSB3_weight');
+LSB_op=V1*LSB_weight;// Change in output voltage due to change in LSB
+printf('The change in output voltage due to change in LSB = %.4f V \n ',LSB_op);
+LSB2_op=V1*LSB2_weight;
+printf('THe 2nd LSB causes a change in output voltage of %.4f V \n ',LSB2_op);
+LSB3_op=V1*LSB3_weight;
+printf('THe 3rd LSB causes a change in output voltage of %.4f V \n ',LSB3_op);
+Va=(V1*2^4+V1*2^3+V0*2^2+V1*2^1+V1*2^0)/(2^n-1);// output voltage for digital Ip1
+Vb=(V1*2^4+V0*2^3+V1*2^2+V1*2^1+V0*2^0)/(2^n-1);
+printf('The output voltage for a digital input 1 and 2 are %.2f V and %.3f V respectively \n ',Va,Vb);
diff --git a/3554/CH17/EX17.2/Ex17_2.sce b/3554/CH17/EX17.2/Ex17_2.sce
new file mode 100644
index 000000000..2141dcc59
--- /dev/null
+++ b/3554/CH17/EX17.2/Ex17_2.sce
@@ -0,0 +1,20 @@
+
+// Exa17.2
+
+clc;
+clear all;
+
+// Given data
+
+n=5;// 5 bit ladder
+V=10;// For binary 1
+
+// Solution
+// refering table 17.4(page no. 615)-Various Output voltage for corresponding MSB
+
+disp("The output voltage for each bit is as follows:");
+disp("");
+for i=1:n
+MSB(i)=V/2^i; //voltage corresponding to MSB i
+printf(' %d MSB Va = V/2^%d = %.4f V \n ',i,i, MSB(i));
+end
diff --git a/3554/CH17/EX17.3/Ex17_3.sce b/3554/CH17/EX17.3/Ex17_3.sce
new file mode 100644
index 000000000..00703a724
--- /dev/null
+++ b/3554/CH17/EX17.3/Ex17_3.sce
@@ -0,0 +1,18 @@
+// Exa 17.3
+
+clc;
+clear all;
+
+// Given data
+
+Vin=5;// Input voltage(Volts)
+Rin=2.5;// k Ohms
+Rf=1;//k Ohms
+
+// Solution
+
+Iin=Vin/Rin;//Input current(mA)
+If=Iin;
+Vout=-If*Rf;
+
+printf('The output voltage = %d Volts \n',Vout);
diff --git a/3554/CH17/EX17.4/Ex17_4.sce b/3554/CH17/EX17.4/Ex17_4.sce
new file mode 100644
index 000000000..db85b5236
--- /dev/null
+++ b/3554/CH17/EX17.4/Ex17_4.sce
@@ -0,0 +1,22 @@
+// Exa 17.4
+
+clc;
+clear all;
+
+// Given data
+Vref=5;//Reference voltage(V)
+R=5;// k Ohms
+
+// Solution
+
+disp("From fig. 17.18(c) , for a 4-bit D/A converter I=Vref/R* (D3+D2*2^-1+D1*2^-2+D0*^-3)");
+//16-input combinations are as follows
+Ip={[0 0 0 0];[0 0 0 1];[0 0 1 0];[0 0 1 1];[0 1 0 0];[0 1 0 1];[0 1 1 0];[0 1 1 1];[1 0 0 0];[1 0 0 1];
+[1 0 1 0];[1 0 1 1];[1 1 0 0];[1 1 0 1];[1 1 1 0];[1 1 1 1]};//[D3 D2 D1 D0 bits]
+
+disp(" Input Bits Output Current(mA) percent Fraction of maximum ");
+for i=1:16
+Iout(i)=Vref/R * (Ip(i,1)+Ip(i,2)*2^-1+Ip(i,3)*2^-2+Ip(i,4)*2^-3);
+
+printf(' %d %d %d %d %.3f %.3f \n',Ip(i,1),Ip(i,2),Ip(i,3),Ip(i,4),Iout(i),(Iout(i)/1.875)*100);//1.875(mA) is the highest output current
+end