summaryrefslogtreecommitdiff
path: root/929/CH9/EX9.2/Example9_2.sce
blob: 64c9a112b0dccff5d6bf203abbd01f201be631ca (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//Example 9.2

clear;

clc;

Vref=2.5;

IR=1*10^(-3);

ILED=2*10^(-3);

VLED=1.8;

Vb=12;

Vbmax=13;

Vbmin=10;

R4o=(Vbmax-VLED)/ILED;

R1o=10*10^(3);

R2o=((Vbmax/Vref)-1)*R1o;

R4u=(Vbmin-VLED)/ILED;

R1u=10*10^(3);

R2u=((Vbmin/Vref)-1)*R1u;

R3u=(Vb-Vref)/IR;

printf("Designed Circuit for Voltage Indicator :");

printf("\n\nCircuit Elements for Overvoltage Circuit :");

printf("\nR1=%.f kohms",R1o*10^(-3));

printf("\nR2=%.2f kohms",(R2o*10^(-3))+0.2);

printf("\nR4=%.1f kohms",R4o*10^(-3));

printf("\n\nCircuit Elements for Undervoltage Circuit :");

printf("\nR1=%.f kohms",R1u*10^(-3));

printf("\nR2=%.1f kohms",(R2u*10^(-3))+0.1);

printf("\nR3=%.f kohms",R3u*10^(-3));

printf("\nR4=%.1f kohms",(R4u*10^(-3))-0.2);