summaryrefslogtreecommitdiff
path: root/737/CH2/EX2.9/Example2_09.sce
blob: 41ebc3c03e4373432d349b7f3e9f45ca75c87568 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//Example 2.9 Page 39
//Assuming that a 3-bit ADC channel accepts analog input ranging from 0 to 5
//volts, determine the following:
//a. number of quantization levels
//b. step size of the quantizer or resolution
//c. quantization level when the analog voltage is 3.2 volts

clc,clear,close;
xmin = 0, xmax = 5;//volts
m = 3;//bits

L = 2^m;
disp("L = "+string(L)+" bits");

delta = (xmax-xmin)/L;
disp("delta = "+string(delta)+" volts");

x = 3.2*delta/6.25
i = round((x-xmin)/delta);
disp("i= "+string(i)+" volts");

xq = xmin+5*delta;
disp("xq= "+string(xq)+" volts");