summaryrefslogtreecommitdiff
path: root/3682/CH10/EX10.1/Ex10_1.sce
diff options
context:
space:
mode:
Diffstat (limited to '3682/CH10/EX10.1/Ex10_1.sce')
-rw-r--r--3682/CH10/EX10.1/Ex10_1.sce22
1 files changed, 22 insertions, 0 deletions
diff --git a/3682/CH10/EX10.1/Ex10_1.sce b/3682/CH10/EX10.1/Ex10_1.sce
new file mode 100644
index 000000000..ed3ffa07b
--- /dev/null
+++ b/3682/CH10/EX10.1/Ex10_1.sce
@@ -0,0 +1,22 @@
+// Exa 10.1
+
+clc;
+clear;
+
+// Given data
+
+//9-bit DAC
+step = 10.3; // mV
+y=[1 0 1 1 0 1 1 1 1];
+n = 9; // since 9 bit DAC
+
+// Solution
+
+i = n;
+add = 0;
+while(i>0)
+ op = step*2^(i-1)*y((n+1)-i);
+ i = i-1;
+ add = add + op
+ end
+printf('The output voltage for input 101101111 is %.2f V. \n',add*10^-3);