blob: d7a3474d18eeab746972f6d9c2e639190a53578b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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);
|