diff options
Diffstat (limited to '3871/CH14')
-rw-r--r-- | 3871/CH14/EX14.1/Ex14_1.sce | 22 | ||||
-rw-r--r-- | 3871/CH14/EX14.2/Ex14_2.sce | 29 | ||||
-rw-r--r-- | 3871/CH14/EX14.3/Ex14_3.sce | 22 | ||||
-rw-r--r-- | 3871/CH14/EX14.4/Ex14_4.sce | 14 | ||||
-rw-r--r-- | 3871/CH14/EX14.5/Ex14_5.sce | 26 | ||||
-rw-r--r-- | 3871/CH14/EX14.6/Ex14_6.sce | 26 | ||||
-rw-r--r-- | 3871/CH14/EX14.7/Ex14_7.sce | 25 | ||||
-rw-r--r-- | 3871/CH14/EX14.8/Ex14_8.sce | 27 | ||||
-rw-r--r-- | 3871/CH14/EX14.9/Ex14_9.sce | 30 |
9 files changed, 221 insertions, 0 deletions
diff --git a/3871/CH14/EX14.1/Ex14_1.sce b/3871/CH14/EX14.1/Ex14_1.sce new file mode 100644 index 000000000..7a9426659 --- /dev/null +++ b/3871/CH14/EX14.1/Ex14_1.sce @@ -0,0 +1,22 @@ +//=====================================================================================
+//Chapter 14 example 1
+clc;
+clear all;
+
+//variable declaration
+VREF =10; //reference voltage in V
+
+
+//calculations
+W1 = VREF/2; //the second MSB weight in V
+W2 = VREF/4; //the third MSB weight in V
+W3 = VREF/8 //the fourth (or LSB ) MSB weight in V
+W = VREF+W1+W2+W3; //full scale output in V
+r = W/4; //resolution in V
+
+//result
+mprintf("the second MSB weight =%3.2d",W1);
+mprintf("\nthe third MSB weight =%3.2d",W2);
+mprintf("\nthe fourth (or LSB ) weight =%3.2d",W3);
+mprintf("\nthe resolution of DAC is equal to the weight of the LSB = %3.2f V",W3);
+mprintf("\nfull scale output = %3.2f V",r);
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);
diff --git a/3871/CH14/EX14.3/Ex14_3.sce b/3871/CH14/EX14.3/Ex14_3.sce new file mode 100644 index 000000000..aa9e94930 --- /dev/null +++ b/3871/CH14/EX14.3/Ex14_3.sce @@ -0,0 +1,22 @@ +//=====================================================================================
+//Chapter 14 example 3
+
+clc;
+clear all;
+
+//variable declaration
+
+T = 2500; //transitions per second
+t1 = 0.1; //time in s
+t2 = 1; //time in s
+t3 = 10; //time in s
+
+//calculations
+C1 = T*t1; //counter can count or display
+C2 = T*t2; //counter can count or display
+C3 = T*t3; //counter can count or display
+
+//result
+mprintf(" counter can count or display when 0.1 s = %3.2d",C1);
+mprintf(" \ncounter can count or display when 1 s = %3.2d",C2);
+mprintf(" \ncounter can count or display when 10 s = %3.2d",C3);
diff --git a/3871/CH14/EX14.4/Ex14_4.sce b/3871/CH14/EX14.4/Ex14_4.sce new file mode 100644 index 000000000..e2c726603 --- /dev/null +++ b/3871/CH14/EX14.4/Ex14_4.sce @@ -0,0 +1,14 @@ +//=====================================================================================
+//Chapter 14 example 4
+clc;
+clear al;
+
+//variable declaration
+N = 45; //count
+t = 0.01; //gate enable time in s
+
+//calculations
+f = N/t; //frequency in Hz
+
+//result
+mprintf("frequency = %3.1f kHz",(f*10^-3));
diff --git a/3871/CH14/EX14.5/Ex14_5.sce b/3871/CH14/EX14.5/Ex14_5.sce new file mode 100644 index 000000000..706237a9d --- /dev/null +++ b/3871/CH14/EX14.5/Ex14_5.sce @@ -0,0 +1,26 @@ +//=====================================================================================
+//Chapter 14 example 5
+clc;
+clear all;
+
+//variable declaration
+t = 5*10^6; //time reaading in ms
+t2 = 500; //time reaading in ms
+x = 0.005; //accuracy in percent of reading
+t3 = 500*10^3; //time reaading in ms
+
+//calculations
+e = ((x/100)*t)+1; //maximum likely timing error in ms
+e1 = ((x/100)*t2)+1; //maximum timing error in ms
+a = t2*10^6; //maximum accuracy mininum error will be obtained when the time is read on the us read
+e3 = ((x/100)*t3)+1; //maximum timing error in ms
+
+//result
+mprintf("maximum likely timing error when time reading is 05000000 ms = %3.2f ms",e);
+mprintf("\nmaximum timing error when time reading is 00000500 ms = %3.2f ms",e1);
+mprintf("\nmaximum error when time reading is 00500000 = %3.2f ms",e3);
+
+
+
+
+
diff --git a/3871/CH14/EX14.6/Ex14_6.sce b/3871/CH14/EX14.6/Ex14_6.sce new file mode 100644 index 000000000..d7a3474d1 --- /dev/null +++ b/3871/CH14/EX14.6/Ex14_6.sce @@ -0,0 +1,26 @@ +//=====================================================================================
+//Chapter 14 example 6
+
+clc;
+clear all;
+
+//variable declaration
+n =3; //number of full digits
+v1 = 1; //voltage in V
+v2 = 10; //voltage in V
+v3 = 5; //voltage in V
+a = 0.5; //accuracy of reading in %
+r = 2; //reading in V
+
+//calculations
+R = 1/(10^n); //resolution
+V1 = R*v1; //for full scale range of 1V ,the resolution in V
+V2 = R*v2; //for full scale range of 10V ,the resolution in V
+v = v3*R; //the digit in least significant digit has a value of in V
+e = ((a/100)*r)+v; //total possible error on in V
+
+//result
+mprintf("for full scale range of 1V ,the resolution = %3.4f V",V1);
+mprintf("\nfor full scale range of 10V ,the resolution = %3.4f V",V2);
+mprintf("\ntotal possible error = %3.5f V",e);
+
diff --git a/3871/CH14/EX14.7/Ex14_7.sce b/3871/CH14/EX14.7/Ex14_7.sce new file mode 100644 index 000000000..6c5ff2899 --- /dev/null +++ b/3871/CH14/EX14.7/Ex14_7.sce @@ -0,0 +1,25 @@ +//=====================================================================================
+//Chapter 14 example 7
+clc;
+clear all;
+
+//variable declaration
+n =4; //number of full digits
+v1 = 1; //voltage in V
+v2 = 10; //voltage in V
+
+//calculations
+R = 1/(10^n); //resolution
+R1 = R*v1; //resolution on 1V range in V
+R2 = R*v2; //resolution on 10V range in V
+
+//result
+mprintf("R = %3.4f V",R);
+
+mprintf("\nthere are 5 digits in 4 (1/2) display digit display ,so 15.84 would display as 15.840");
+mprintf("\nR1 = %3.4f V",R1);
+mprintf("\nany reading upto 4 th decimal can be displayed ");
+mprintf("\nhence 0.5243 can be dislayed as 0.5243")
+mprintf("\n R2 = %3.4f V",R2);
+mprintf("\nany reading upto third decimal can be displayed ");
+mprintf("\nhence 0.5243 can be dislayed as 0.524 instead of 0.5243");
diff --git a/3871/CH14/EX14.8/Ex14_8.sce b/3871/CH14/EX14.8/Ex14_8.sce new file mode 100644 index 000000000..7b67b2880 --- /dev/null +++ b/3871/CH14/EX14.8/Ex14_8.sce @@ -0,0 +1,27 @@ +//=====================================================================================
+//Chapter 14 example 8
+
+clc;
+clear all;
+
+//variable declaration
+n =3; //number of full digits
+v1 = 10; //voltage in V
+v2 = 100; //voltage in V
+
+//calculations
+R = 1/(10^n); //resolution
+R1 = R*v1; //resolution on 1V range in V
+R2 = R*v2; //resolution on 10V range in V
+
+//result
+mprintf("R = %3.4f V",R);
+
+mprintf("\nthe meter cannot distinguish the values that differ from each by less than 0.001 of full scale");
+mprintf("\nR1 = %3.4f V",R1);
+mprintf("\nany decimal upto second decimal can be displayed ");
+mprintf("\nhence 15.45 can be dislayed as 15.45")
+mprintf("\n R2 = %3.4f V",R2);
+mprintf("\nany deccimal upto one decimal can be displayed ");
+mprintf("\nhence 25.65 can be dislayed as 025.6 instead of 25.65");
+
diff --git a/3871/CH14/EX14.9/Ex14_9.sce b/3871/CH14/EX14.9/Ex14_9.sce new file mode 100644 index 000000000..63e0840bb --- /dev/null +++ b/3871/CH14/EX14.9/Ex14_9.sce @@ -0,0 +1,30 @@ +//=====================================================================================
+//Chapter 14 example 9
+
+clc;
+clear all;
+
+//variable declaration
+n =4; //number of full digits
+v1 = 10; //voltage in V
+V1 = 1; //voltage in V
+V2 =10; //voltage in V
+
+//calculations
+R = 1/(10^n); //resolution
+R1 = R*v1; //resolution on 1V range in V
+R2 = R*V1; //resolution on 1V range in V for display 0.6132 V
+R3 = R*V2; //resolution on 10V range in V for display 0.6132 V
+
+//result
+mprintf("R = %3.4f V",R);
+mprintf("\nR1 = %3.4f V",R1);
+mprintf("\nany decimal upto third decimal can be displayed ");
+mprintf("\nhence 13.97 can be dislayed as 13.970")
+mprintf("\n R2 = %3.4f V",R2);
+mprintf("\nany deccimal upto fourth decimal can be displayed on 1V");
+mprintf("\nhence 0.6132 can be dislayed as 0.6132 V");
+mprintf("\n R3 = %3.4f V",R3);
+mprintf("\nany deccimal upto third decimal can be displayed on 10 V ");
+mprintf("\nhence 0.6132 can be dislayed as 0.613 V");
+
|