Professional Documents
Culture Documents
1 Funded
Book Description
Title: Op-Amps And Linear Integrated Circuits
Author: R. A. Gayakwad
Publisher: PHI Learning Pvt. Ltd., New Delhi
Edition: 4
Year: 2004
ISBN: 978-81-203-2058-1
Scilab numbering policy used in this document and the relation to the
above book.
Exa Example (Solved example)
Eqn Equation (Particular equation of the above book)
AP Appendix to Example(Scilab Code that is an Appednix to a particular
Example of the above book)
For example, Exa 3.51 means solved example 3.51 of this book. Sec 2.3 means
a scilab code whose theory is explained in Section 2.3 of the book.
Contents
List of Scilab Codes
14
21
37
40
53
74
9 Specialized IC Applications
80
11
1.1.a
1.1.b
1.1.c
2.1.a
2.1.b
2.2.a
2.2.b
3.1
3.2
3.3
3.4
3.5.a
3.5.b
3.6.a
3.6.b
4.1
4.2
4.3
4.4.a
4.4.b
4.5.a
4.5.b
4.6
4.7
4.8.a
4.8.b
4.9.a
4.9.b
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
7
9
9
11
12
12
13
14
15
16
17
18
18
19
20
21
22
22
23
24
24
25
25
26
27
28
29
30
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
4.10.a
4.10.b
4.11.a
4.11.b
4.12
4.13
4.14.a
4.14.b
5.1
5.2
5.3
6.1
6.2.a
6.2.b
6.3
6.4
6.5
6.6
6.7
6.8
6.9
6.10
6.11
6.12.a
6.12.b
6.13
6.14
6.15
6.16.a
6.16.b
7.1
7.2
7.3
7.4.a
7.4.b
7.5.a
7.5.b
7.6.a
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
30
31
32
33
34
34
35
35
37
38
38
40
41
42
42
43
44
44
45
46
46
47
47
48
48
49
49
50
51
52
53
54
54
56
57
58
59
61
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
7.6.b
7.7.a
7.7.b
7.7.c
7.8.a
7.8.b
7.9
7.10
7.11
7.12
7.13
7.14
7.15
7.16
7.17.a
7.17.b
8.1
8.2
8.3
8.4
8.5
9.1
9.2
9.3
9.4
9.5
9.6
9.7
9.8
9.9
9.10
9.11
9.12
9.13
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
61
63
64
65
66
67
67
68
68
69
70
70
71
71
72
73
74
75
76
78
78
80
81
82
83
83
84
84
85
86
86
87
88
90
Chapter 1
Introduction to Operational
Amplifier
Voltage in v o l t s
Rc1 =6.7*10^3; // R e s i s t a n c e i n ohms
Ic1 = rand () ;
Vc1 = Vcc - Rc1 * Ic1 ;
Ve4 = Vc1 - Vbe5 ;
I4 =( Ve4 + Vee ) /(9.1*10^3+5.5*10^3) ;
Vb3 =5.5*10^3* I4 - Vee ;
Ve3 = Vb3 - Vbe3 ;
Ie3 =( Ve3 + Vbe3 ) /3.3*10^3;
Ic1 =1.08*10^ -3/2.765; // S i n c e I e 3 =2 I c 1 ,
s u b s t i t u t i n g i n a b o v e e q u a t i o n and s i m p l i f y i n g
printf ( \n C o l l e c t o r c u r r e n t I c 1 i s = %. 5 f A \n , Ic1
7
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
) // R e s u l t
Vc1 = Vcc - Rc1 * Ic1 ;
printf ( \n V o l t a g e Vc1 i s = %. 2 f V \n , Vc1 ) //
Result
Ve4 = Vc1 - Vbe5 ;
printf ( \n V o l t a g e Ve4 i s = %. 2 f V \n , Ve4 ) //
Result
Ie4 =( Ve4 + Vee ) /(29.2*10^3) ;
printf ( \n C u r r e n t I e 4 i s = %. 6 f A \n , Ie4 ) //
Result
Ic5 = Ie4 ;
printf ( \n C u r r e n t I c 5 i s = %. 6 f A \n , Ic5 ) //
Result
Vc5 = Vcc -3.8*10^3* Ic5 ;
printf ( \n V o l t a g e Vc5 i s = %. 2 f V \n , Vc5 ) //
Result
Ve6 = Vc5 - Vbe6 ;
printf ( \n V o l t a g e Ve6 i s = %. 2 f V \n , Ve6 ) //
Result
Ie6 =( Ve6 + Vee ) /(15*10^3) ;
printf ( \n C u r r e n t I e 6 i s = %. 6 f A \n , Ie6 ) //
Result
Ve7 = Ve6 + Vbe7 ;
printf ( \n V o l t a g e Ve7 i s = %. 2 f V \n , Ve7 ) //
Result
I1 =( Vcc - Ve7 ) /400;
printf ( \n C u r r e n t I 1 i s = %. 6 f A \n , I1 ) // R e s u l t
Ie8 = I1 ;
printf ( \n C u r r e n t I e 8 i s = %. 6 f A \n , Ie8 ) //
Result
Ve8 = - Vee +2*10^3* Ie8 ;
printf ( \n V o l t a g e Ve8 a t t h e o u t p u t t e r m i n a l i s = %
. 2 f V \n , Ve8 ) // R e s u l t
18
19
20
21
22
C u r r e n t i n amps
Rc1 =6.7*10^3; Rc5 =3.8*10^3; // R e s i s t a n c e i n ohms
beta_ac =150;
re1 =(25*10^ -3) / Ie1 ;
re2 = re1 ;
re4 =(25*10^ -3) / Ie4 ;
re5 = re4 ;
re6 =(25*10^ -3) / Ie6 ;
k =( Rc1 *2* beta_ac * re4 ) /( Rc1 +2* beta_ac * re4 ) ;
Ad1 = k / re1 ;
printf ( \n V o l t a g e g a i n o f t h e d u a l i n p u t , b a l a n c e d
o u t p u t d i f f e r e n t i a l a m p l i f i e r i s = %. 2 f \n , Ad1 )
// R e s u l t
k1 =( Rc5 * beta_ac *( re6 +15*10^3) ) /( Rc5 + beta_ac *( re6
+15*10^3) ) ;
Ad2 = k1 /(2* re5 ) ;
printf ( \n V o l t a g e g a i n o f t h e d u a l i n p u t , u n b a l a n c e d
o u t p u t d i f f e r e n t i a l a m p l i f i e r i s = %. 1 f \n , Ad2
) // R e s u l t
Ad =82.55*22.6; // U s i n g Ad=Ad1Ad2
printf ( \n O v e r a l l g a i n o f t h e opamp i s = %. 2 f \n
, Ad ) // R e s u l t
1 // C h a p t e r 1
2 // Page . No4 ,
3 // E x a m p l e 1 1 c , F i g u r e . No1.2
4 // I n p u t r e s i s t a n c e o f t h e opamp
5 // Given :
6 clear ; clc ;
7 beta_ac =150;
8 re1 =64.1; // R e s i s t a n c e i n ohms
9 Ri =2* beta_ac * re1 ;
10 printf ( \n I n p u t r e s i s t a n c e Ri i s = %. 1 f ohm \n , Ri )
// R e s u l t
10
Chapter 2
Interpretation of Data Sheets
and Characteristics of an
Opamp
Scilab code Exa 2.1.a Output voltage for Openloop differential amplifier
1
2
3
4
5
6
7
8
9
10
// C h a p t e r 2
// Page . No45 , F i g u r e . No2.9
// E x a m p l e 2 1 a
// Output v o l t a g e f o r openl o o p d i f f e r e n t i a l
amplifier
// Given :
clear ; clc ;
vin1 =5*10^ -6; vin2 = -7*10^ -6; // Both i n p u t v o l t a g e s
are in volts
A =200000; // V o l t a g e g a i n
vo = A *( vin1 - vin2 ) ; // Output v o l t a g e i n v o l t s
printf ( \n Output v o l t a g e i s vo = %. 1 f V dc \n , vo )
// R e s u l t
11
Scilab code Exa 2.1.b Output voltage for openloop differential amplifier
1
2
3
4
5
6
7
8
9
10
// C h a p t e r 2
// Page . No45 , F i g u r e . No2.9
// EXAMPLE 2 1 b
// Output v o l t a g e f o r openl o o p d i f f e r e n t i a l
amplifier
// Given :
clear ; clc ;
vin1 =10*10^ -3; vin2 =20*10^ -3; // Both i n p u t v o l t a g e s
are in volts
A =200000; // V o l t a g e g a i n
vo = A *( vin1 - vin2 ) ; // Output v o l t a g e i n v o l t s
printf ( \n Output v o l t a g e i s vo = %. f V rms \n , vo )
// R e s u l t
12
10
printf ( \n Output v o l t a g e i s vo = %. f V \n , vo ) //
Result
Result
13
Chapter 3
An Opamp with Negative
Feedback
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
14
%f ohms \n , RoF ) // R e s u l t
fF = fo *(1+ A * B ) ; // Bandwidth w i t h f e e d b a c k
printf ( \n Bandwidth w i t h f e e d b a c k i s vo = %. 1 f Hz \
n , fF ) // R e s u l t
VooT = Vsat /(1+ A * B ) ; // T o t a l o u t p u t o f f s e t v o l t a g e
with feedback
printf ( \n T o t a l o u t p u t o f f s e t v o l t a g e w i t h f e e d b a c k
i s VooT = %f V \n , VooT ) // R e s u l t
// C h a p t e r 3
// Page . No83 , F i g u r e . No3.7
// E x a m p l e 3 2
// P a r a m e t e r s o f v o l t a g e s e r i e s f e e d b a c k a m p l i f i e r
// Given
clear ; clc ;
R1 =1000; Rf =10000;
A =200000; // Openl o o p v o l t a g e g a i n
Ri =2*10^6; // I n p u t r e s i s t a n c e w i t h o u t f e e d b a c k
Ro =75; // Output r e s i s t a n c e w i t h o u t f e e d b a c k
fo =5; // Break f r e q u e n c y o f an Opamp
Vsat =13; // S a t u r a t i o n v o l t a g e
B =1; // Gain o f t h e f e e d b a c k c i r c u i t and i t i s e q u a l
to 1 f o r voltage f o l l o w e r
Af = A /(1+ A * B ) ; // C l o s e d l o o p v o l t a g e g a i n
printf ( \n C l o s e d l o o p v o l t a g e g a i n i s Af = %. f \n ,
Af ) // R e s u l t
RiF = Ri *(1+ A * B ) ; // I n p u t r e s i s t a n c e w i t h f e e d b a c k
printf ( \n I n p u t r e s i s t a n c e w i t h f e e d b a c k i s RiF = %
. 1 f ohms \n , RiF ) // R e s u l t
15
%f ohms \n , RoF ) // R e s u l t
fF = fo *(1+ A * B ) ; // Bandwidth w i t h f e e d b a c k
printf ( \n Bandwidth w i t h f e e d b a c k i s vo = %. 1 f Hz \
n , fF ) // R e s u l t
VooT = Vsat /(1+ A * B ) ; // T o t a l o u t p u t o f f s e t v o l t a g e
with feedback
printf ( \n T o t a l o u t p u t o f f s e t v o l t a g e w i t h f e e d b a c k
i s VooT = %f V \n , VooT ) // R e s u l t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
16
19
20
21
22
23
24
25
printf ( \n I n p u t r e s i s t a n c e w i t h f e e d b a c k i s RiF = %
. 1 f ohms \n , RiF ) // R e s u l t
RoF = Ro /(1+ A * B ) ; // Output r e s i s t a n c e w i t h f e e d b a c k
printf ( \n Output r e s i s t a n c e w i t h f e e d b a c k i s RoF =
%f ohms \n , RoF ) // R e s u l t
fF = fo *(1+ A * B ) / K ; // Bandwidth w i t h f e e d b a c k
printf ( \n Bandwidth w i t h f e e d b a c k i s vo = %. 2 f Hz \
n , fF ) // R e s u l t
VooT = Vsat /(1+ A * B ) ; // T o t a l o u t p u t o f f s e t v o l t a g e
with feedback
printf ( \n T o t a l o u t p u t o f f s e t v o l t a g e w i t h f e e d b a c k
i s VooT = %f V \n , VooT ) // R e s u l t
Scilab code Exa 3.4 Output voltage of voltage shunt feedback amplifier
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//
//
//
//
Chapter3
Page . No86 , F i g u r e . No3.8
Example 3 4
Output v o l t a g e o f v o l t a g e s h u n t f e e d b a c k
amplifier
// Given
clear ; clc ;
R1 =470; Rf =4.7*10^3;
A =200000; // Openl o o p v o l t a g e g a i n
vin =1; // I n p u t v o l t a g e i n v o l t s
K = Rf /( R1 + Rf ) ; // V o l t a g e a t t e n u a t i o n f a c t o r
B = R1 /( R1 + Rf ) ; // Gain o f t h e f e e d b a c k c i r c u i t
Af = -( A * K ) /(1+ A * B ) ; // C l o s e d l o o p v o l t a g e g a i n
vo = Af * vin ; // Output v o l t a g e
printf ( \n Output v o l t a g e i s vo = %. f V \n , vo ) //
Result
t =0:0.1:2* %pi ;
vo = -10* sin ( t ) ;
17
17
18
19
20
plot (t , vo ) ;
title ( Output V o l t a g e ) ;
xlabel ( t ) ;
ylabel ( Vo ) ;
Result
RiFx = R1 ; // I n p u t r e s i s t a n c e o f i n v e r t i n g a m p l i f i e r
printf ( \n I n p u t r e s i s t a n c e o f i n v e r t i n g a m p l i f i e r
i s RiFx = %. f ohms \n , RiFx ) // R e s u l t
13 RiFy = R2 + R3 ; // I n p u t r e s i s t a n c e o f noni n v e r t i n g
amplifier
14 printf ( \n I n p u t r e s i s t a n c e o f noni n v e r t i n g
a m p l i f i e r i s RiFy = %. f ohms \n , RiFy ) // R e s u l t
11
12
// C h a p t e r 3
18
2
3
4
5
6
7
8
9
10
11
12
Scilab code Exa 3.6.a Voltage gain and input resistance of the Opamp
1 // C h a p t e r 3
2 // Page . No99 , F i g u r e . No 3.16
3 // E x a m p l e 3 6 a
4 // V o l t a g e g a i n and i n p u t r e s i s t a n c e o f Opamp
5 // Given
6 clear ; clc ;
7 R1 =680; R3 =680; // Both a r e i n ohms
8 RF =6800; R2 =6800; // Both a r e i n ohms
9 Ri =2*10^6; // Openl o o p i n p u t r e s i s t a n c e o f t h e op
10
11
12
13
14
15
amp
vx = -1.5; vy = -2; // Both a r e i n v o l t s
A =200000; // Openl o o p Gain
AD =1+ RF / R1 ; // V o l t a g e g a i n
printf ( \n V o l t a g e g a i n i s AD = %. f \n , AD ) //
Result
B = R2 /( R2 + R3 ) ;
RiFy = Ri *(1+ A * B ) ; // I n p u t r e s i s t a n c e o f f i r s t s t a g e
amplifier
19
printf ( \n I n p u t r e s i s t a n c e o f f i r s t s t a g e a m p l i f i e r
i s RiFy = %. 1 f ohms \n , RiFy ) // R e s u l t
17 B = R1 /( R1 + RF ) ;
18 RiFx = Ri *(1+ A * B ) ; // I n p u t r e s i s t a n c e o f s e c o n d s t a g e
amplifier
19 printf ( \n I n p u t r e s i s t a n c e o f s e c o n d s t a g e
a m p l i f i e r i s RiFx = %. 1 f ohms \n , RiFx ) // R e s u l t
16
// C h a p t e r 3
// Page . No99 , F i g u r e . No 3.16
// E x a m p l e 3 6 b
// Output v o l t a g e o f t h e Opamp
// Given
clear ; clc ;
R1 =680; RF =6800 // Both a r e i n ohms
vx = -1.5; vy = -2; // Both i n p u t v o l t a g e s a r e i n v o l t s
AD =1+ RF / R1 ; // V o l t a g e g a i n
vxy = vx - vy ;
vo = AD * vxy ; // Output v o l t a g e
printf ( \n Output v o l t a g e i s vo = %. 1 f V \n , vo ) //
Result
20
Chapter 4
The Practical Opamp
21
\n , Voo ) // R e s u l t
Scilab code Exa 4.3 Design of input offset voltage compensating network
Chapter4
Page . No121 , F i g u r e . No 4.14
Example 4 3
D e s i g n o f i n p u t o f f s e t v o l t a g e c o m p e n s a t i n g
network
5 // Given
6 clear ; clc ;
1
2
3
4
//
//
//
//
22
inverting amplifier
9 printf ( \n C l o s e d l o o p g a i n o f noni n v e r t i n g
a m p l i f i e r i s = %. 1 f \n , Af ) // R e s u l t
// C h a p t e r 4
// Page . No127 , F i g u r e . No 4.19
// E x a m p l e 4 4 a
// Max Output o f f s e t v o l t a g e
// Given
clear ; clc ;
R1 =470; Rf =47*10^3;
Vio =6*10^ -3;
Ib =500*10^ -9;
Vs =15;
// Max o u t p u t o f f s e t v o l t a g e due t o i n p u t o f f s e t
v o l t a g e , Vio i s :
Voo =(1+ Rf / R1 ) * Vio ; // Max o u t p u t o f f s e t v o l t a g e
printf ( \n Max o u t p u t o f f s e t v o l t a g e i s = %. 3 f V dc
\n , Voo ) // R e s u l t
// Max o u t p u t o f f s e t v o l t a g e due t o i n p u t o f f s e t
voltage , Ib i s :
VoIb = Rf * Ib ; // Max o u t p u t o f f s e t v o l t a g e
printf ( \n Max o u t p u t o f f s e t v o l t a g e due t o i n p u t
o f f s e t c u r r e n t , I b i s = %. 6 f V dc \n , VoIb ) //
Result
23
Rf
9 printf ( \n P a r a l l e l c o m b i n a t i o n o f R1 and Rf , i . e ROM
i s = %. 1 f ohm \n , ROM ) // A p p r o x i m a t e l y t h e
v a l u e i s 47 ohm
// C h a p t e r 4
// Page . No127 , F i g u r e . No 4.19
// E x a m p l e 4 5 a
// Max Output o f f s e t v o l t a g e
// Given
clear ; clc ;
R1 =1*10^3; Rf =100*10^3;
Vio =6*10^ -3;
Ib =500*10^ -9;
Vs =15;
24
11
12
13
14
15
16
// Max o u t p u t o f f s e t v o l t a g e due t o i n p u t o f f s e t
v o l t a g e , Vio i s :
Voo =(1+ Rf / R1 ) * Vio ; // Max o u t p u t o f f s e t v o l t a g e
printf ( \n Max o u t p u t o f f s e t v o l t a g e due t o i n p u t
o f f s e t v o l t a g e , Vio i s = %. 4 f V dc \n , Voo ) //
Result
// Max o u t p u t o f f s e t v o l t a g e due t o i n p u t o f f s e t
voltage , Ib i s :
VoIb = Rf * Ib ; // Max o u t p u t o f f s e t v o l t a g e
printf ( \n Max o u t p u t o f f s e t v o l t a g e due t o i n p u t
o f f s e t c u r r e n t , I b i s = %. 4 f V dc \n , VoIb ) //
Result
Rf
printf ( \n P a r a l l e l c o m b i n a t i o n o f R1 and Rf , i . e ROM
i s = %. f ohm \n , ROM )
25
1 // C h a p t e r 4
2 // Page . No130 , F i g u r e . No 4.21
3 // E x a m p l e 4 6
4 // Max Output o f f s e t v o l t a g e
5 // Given
6 clear ; clc ;
7 Iio =200*10^ -9; // I n p u t o f f s e t c u r r e n t
8 Rf =100*10^3;
9 VoIio = Rf * Iio ; // Max o u t p u t o f f s e t v o l t a g e
10 printf ( \n Max o u t p u t o f f s e t v o l t a g e due t o i n p u t
o f f s e t c u r r e n t , I b i s = %. 4 f V dc \n , VoIio ) //
Result
1
2
3
4
5
6
7
8
9
10
11
12
14
26
// For f i g u r e 4 . 2 2 ( b )
VooT =(1+ Rf / R1 ) * Vio +( Rf * Iio ) ; // S i n c e t h e c u r r e n t
g e n e r a t e d o u t p u t o f f s e t v o l t a g e i s due t o i n p u t
o f f s e t c u r r e n t Ib
17 printf ( \n Max t o t a l o u t p u t o f f s e t v o l t a g e due t o
i n p u t o f f s e t c u r r e n t , I b i s = %. 4 f V \n , VooT ) //
Result
15
16
// C h a p t e r 4
// Page . No136 , F i g u r e . No 4.24
// E x a m p l e 4 8 a
// E r r o r v o l t a g e and o u t p u t v o l t a g e
// Given
clear ; clc ;
delta_Vio =(30*10^ -6) ; // Change i n i n p u t o f f s e t
voltage
delta_T =1; // U n i t c h a n g e i n t e m p e r a t u r e
delta_Iio =(300*10^ -12) ; // Change i n i n p u t o f f s e t
current
Vs =15;
R1 =1*10^3; Rf =100*10^3; Rl =10*10^3;
Vin =1*10^ -3; // I n p u t v o l t a g e
k =25; // A m p l i f i e r i s n u l l e d a t 25 deg
T =35 - k ; // Change i n t e m p e r a t u r e
Ev =(1+ Rf / R1 ) *( delta_Vio / delta_T ) * T + Rf *( delta_Iio /
delta_T ) * T ; // E r r o r v o l t a g e
printf ( \n E r r o r v o l t a g e i s = %. 4 f V \n , Ev ) //
Result
Vo = -( Rf / R1 ) * Vin + Ev ; // Output v o l t a g e
printf ( \n Output v o l t a g e i s = %. 4 f V \n , Vo ) //
Result
27
19 // (OR)
20 Vo = -( Rf / R1 ) * Vin - Ev ; // Output v o l t a g e
21 printf ( \n Output v o l t a g e i s = %. 4 f V \n , Vo ) //
Result
// C h a p t e r 4
// Page . No136 , F i g u r e . No 4.24
// E x a m p l e 4 8 b
// E r r o r v o l t a g e and o u t p u t v o l t a g e
// Given
clear ; clc ;
delta_Vio =(30*10^ -6) ; // Change i n i n p u t o f f s e t
voltage
delta_T =1; // U n i t c h a n g e i n t e m p e r a t u r e
delta_Iio =(300*10^ -12) ; // Change i n i n p u t o f f s e t
current
Vs =15;
R1 =1*10^3; Rf =100*10^3; Rl =10*10^3;
Vin =10*10^ -3; // I n p u t v o l t a g e
k =25; // A m p l i f i e r i s n u l l e d a t 25 deg
T =35 - k ; // Change i n t e m p e r a t u r e
Ev =(1+ Rf / R1 ) *( delta_Vio / delta_T ) * T + Rf *( delta_Iio /
delta_T ) * T ; // E r r o r v o l t a g e
printf ( \n E r r o r v o l t a g e i s = %. 4 f V \n , Ev ) //
Result
Vo = -( Rf / R1 ) * Vin + Ev ; // Output v o l t a g e
printf ( \n Output v o l t a g e i s = %. 4 f V \n , Vo ) //
Result
// (OR)
Vo = -( Rf / R1 ) * Vin - Ev ; // Output v o l t a g e
printf ( \n Output v o l t a g e i s = %. 4 f V \n , Vo ) //
28
Result
// C h a p t e r 4
// Page . No136 , F i g u r e . No 4.24
// E x a m p l e 4 9 a
// E r r o r v o l t a g e and o u t p u t v o l t a g e
// Given
clear ; clc ;
delta_Vio =(30*10^ -6) ; // Change i n i n p u t o f f s e t
voltage
delta_T =1; // U n i t c h a n g e i n t e m p e r a t u r e
delta_Iio =(300*10^ -12) ; // Change i n i n p u t o f f s e t
current
Vs =15;
R1 =1*10^3; Rf =100*10^3; Rl =10*10^3;
Vin =10*10^ -3; // I n p u t v o l t a g e
k =25; // A m p l i f i e r i s n u l l e d a t 25 deg
T =55 - k ; // Change i n t e m p e r a t u r e
Ev =(1+ Rf / R1 ) *( delta_Vio / delta_T ) * T + Rf *( delta_Iio /
delta_T ) * T ; // E r r o r v o l t a g e
printf ( \n E r r o r v o l t a g e i s = %. 4 f V dc \n , Ev ) //
Result
Vo = -( Rf / R1 ) * Vin + Ev ; // Output v o l t a g e
printf ( \n Output v o l t a g e i s = %. 4 f V \n , Vo ) //
Result
// (OR)
Vo = -( Rf / R1 ) * Vin - Ev ; // Output v o l t a g e
printf ( \n Output v o l t a g e i s = %. 4 f V \n , Vo ) //
Result
29
// C h a p t e r 4
// Page . No136 , F i g u r e . No 4.24
// E x a m p l e 4 9 b
// Output waveform
// Given
clear ; clc ;
t =0:0.1:2* %pi ;
y = -1000* sin ( t ) +91.8;
a = gca () ;
a . x_label . text = Time ;
a . y_label . text = V o l t a g e ;
a . title . text = Output waveform ;
plot2d (t , y ) ;
t1 =0:0.1:2* %pi ;
y1 =91.8*( t1 >=0) ;
b = gca () ;
b . line_style =3;
plot2d ( t1 , y1 ) ;
// C h a p t e r 4
// Page . No141 , F i g u r e . No 4.26
// E x a m p l e 4 1 0 a
// E r r o r v o l t a g e and o u t p u t v o l t a g e
// Given
clear ; clc ;
30
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
1
2
3
4
5
6
7
31
9
10
11
12
13
14
15
16
17
18
19
20
21
// C h a p t e r 4
// Page . No141 , F i g u r e . No 4.28
// E x a m p l e 4 1 1 a
// Output o f f s e t v o l t a g e
// Given
clear ; clc ;
delta_Vio =15.85*10^ -6; // Change i n i n p u t o f f s e t
voltage
delta_V =1; // U n i t c h a n g e i n s u p p l y v o l t a g e
V =2; // Change i n s u p p l y v o l t a g e
R1 =1*10^3; Rf =100*10^3;
delta_Voo =(1+ Rf / R1 ) *( delta_Vio / delta_V ) * V ; // Change
32
in output o f f s e t v o l t a g e
12 printf ( \n Change i n o u t p u t o f f s e t v o l t a g e i s = %. 4 f
V \n , delta_Voo ) // R e s u l t
// C h a p t e r 4
// Page . No141 , F i g u r e . No 4.28
// E x a m p l e 4 1 1 b
// Output o f f s e t v o l t a g e
// Given
clear ; clc ;
delta_Vio =15.85*10^ -6; // Change i n i n p u t o f f s e t
voltage
delta_V =1; // U n i t c h a n g e i n s u p p l y v o l t a g e
V =2; // Change i n s u p p l y v o l t a g e
Vin =10*10^ -3;
R1 =1*10^3; Rf =100*10^3;
delta_Voo =(1+ Rf / R1 ) *( delta_Vio / delta_V ) * V ; // Output
offs et voltage
Vo =( - Rf / R1 ) * Vin + delta_Voo ; // T o t a l o u t p u t o f f s e t
voltage
printf ( \n T o t a l o u t p u t o f f s e t v o l t a g e i s = %. 4 f V \
n , Vo ) // R e s u l t
// (OR)
Vo =( - Rf / R1 ) * Vin - delta_Voo ; // T o t a l o u t p u t o f f s e t
voltage
printf ( \n T o t a l o u t p u t o f f s e t v o l t a g e i s = %. 4 f V \
n , Vo ) // R e s u l t
33
// C h a p t e r 4
// Page . No141 , F i g u r e . No 4 . 2 8 ( b )
// E x a m p l e 4 1 2
// Output r i p p l e v o l t a g e
// Given
clear ; clc ;
delta_Vio =15.85*10^ -6; // Change i n i n p u t o f f s e t
voltage
delta_V =1; // U n i t c h a n g e i n s u p p l y v o l t a g e
V =10*10^ -3; // Change i n s u p p l y v o l t a g e
R1 =1*10^3; Rf =100*10^3;
delta_Voo =(1+ Rf / R1 ) *( delta_Vio / delta_V ) * V ; // Change
in output o f f s e t v o l t a g e
printf ( \n Change i n o u t p u t o f f s e t v o l t a g e i s = %. 6 f
V \n , delta_Voo ) // R e s u l t
// C h a p t e r 4
// Page . No136 , F i g u r e . No 4.24
// E x a m p l e 4 1 3
// Change i n o u t p u t o f f s e t v o l t a g e
// Given
clear ; clc ;
delta_Vio =5*10^ -6; // Change i n i n p u t o f f s e t v o l t a g e
delta_t =1; // U n i t c h a n g e i n t i m e
34
// C h a p t e r 4
// Page . No153 , F i g u r e . No 4.32
// E x a m p l e 4 1 4 a
// Output v o l t a g e
// Given
clear ; clc ;
R1 =1*10^3; R2 =1*10^3; Rf =10*10^3; R3 =10*10^3;
vd =5*10^ -3; // D i f f e r e n t i a l v o l t a g e
vcm =2*10^ -3; // Commonmode v o l t a g e
Ad = Rf / R1 ; // C l o s e d l o o p d i f f e r e n t i a l g a i n
vo = Ad * vd ; // Output v o l t a g e
printf ( \n Output v o l t a g e i s = %. 3 f V \n , vo ) //
Result
// C h a p t e r 4
// Page . No153 , F i g u r e . No 4.32
35
// E x a m p l e 4 1 4 b
// Output commonmode v o l t a g e
// Given
clear ; clc ;
R1 =1*10^3; R2 =1*10^3; Rf =10*10^3; R3 =10*10^3;
vd =5*10^ -3; // D i f f e r e n t i a l v o l t a g e
vcm =2*10^ -3; // Commonmode v o l t a g e
Ad = Rf / R1 ; // C l o s e d l o o p d i f f e r e n t i a l g a i n
CMRRdb =90
CMRR =10^(90/20) ; // U s i n g CMRRdb=20 l o g 1 0 (CMRR) , t o
c o n v e r t t h e CMRR( dB ) v a l u e i n t o i t s e q u u i v a l e n t
numerical value
13 printf ( \n CMRR i s = %. 2 f \n , CMRR ) // R e s u l t
14 vocm =( Ad * vcm ) / CMRR ; // Output commonmode v o l t a g e
15 printf ( \n Output commonmode v o l t a g e i s = %. 8 f V \n
, vocm ) // R e s u l t
3
4
5
6
7
8
9
10
11
12
36
Chapter 5
Frequency Response of an
Opamp
// C h a p t e r 5
// Page . No171 , F i g u r e . No5.4
// E x a m p l e 5 1
// Maximum g a i n
// Given
clear ; clc ;
fo =5; // Break f r e q o f t h e opamp i n Hz
s = %s ;
A =200000; // Gain o f t h e opamp a t 0 Hz
H = syslin ( c ,( A * fo *2* %pi ) /(( fo *2* %pi ) + s ) ) ;
fmin =1;
fmax =100000;
bode (H , fmin , fmax ) ;
Aol =40;
printf ( \n Maximum g a i n i s = %. f dB \n , Aol ) ; //
From t h e g r a p h
37
10
11
12
13
14
/ f o 2 ) j ) ) , where f o 1 f i r s t b r e a k f r e q u e n c y and f o 2
s e c o n d b r e a k f r e q u e n c y ) // From t h e f i g u r e
fo1 =6;
printf ( \n F i r s t b r e a k f r e q u e n c y f o 1 i s = %. f Hz \n
, fo1 ) // From t h e g r a p h
k = - atand ( f / fo1 ) - phase ;
fo2 = f / tand ( k ) ;
printf ( \n S e c o n d b r e a k f r e q u e n c y f o 2 i s = %. 1 f Hz \
n , fo2 ) // R e s u l t
// C h a p t e r 5
// Page . No83 , F i g u r e . No3.7
// E x a m p l e 5 3
// S t a b i l i t y o f v o l t a g e f o l l o w e r
// Given
38
6
7
8
9
10
11
12
13
14
15
clear ; clc ;
fo =5; // Break f r e q o f t h e opamp i n Hz
s = %s ;
A =200000; // Gain o f t h e opamp a t 0 Hz
H = syslin ( c ,( A * fo *2* %pi ) /(( fo *2* %pi ) + s ) ) ;
fmin =10;
fmax =1000000;
bode (H , fmin , fmax ) ;
Aol =0;
printf ( \n Magnitude a t which v o l t a g e f o l l o w e r i s
s t a b l e i s = %. f dB \n , Aol ) ; // From t h e g r a p h
39
Chapter 6
General Linear Applications
being
coupled
RiF = R1 ; // a c i n p u t r e s i s t a n c e o f t h e s e c o n d s t a g e
Ro = Rin ; // a c o u t p u t r e s i s t a n c e o f t h e 1 s t s t a g e
UGB =10^6; // U n i t y g a i n bandwidth
fl =1/(2* %pi * Ci *( RiF + Ro ) ) ; // Lowf r e q c u t o f f
printf ( \n Lowf r e q c u t o f f i s = %. 1 f Hz \n , fl ) //
Result
K = Rf /( R1 + Rf ) ;
Af = - Rf / R1 ; // c l o s e d l o o p v o l t a g e g a i n
fh = UGB * K / abs ( Af ) ; // Highf r e q c u t o f f
printf ( \n Highf r e q c u t o f f i s = %. 1 f Hz \n , fh ) //
Result
BW = fh - fl ; // Bandwidth
40
19
printf ( \n Bandwidth i s = %. 1 f Hz \n , BW ) // R e s u l t
=50;
Ci =0.1*10^ -6; // C a p a c i t a n c e b /w 2 s t a g e s b e i n g
coupled
Ro = Rin ; // a c o u t p u t r e s i s t a n c e o f t h e 1 s t s t a g e
Vcc =15;
UGB =10^6; // U n i t y g a i n bandwidth
Rif = R2 * R3 /( R2 + R3 ) ; // s i n c e Ri (1+AB)>>R2 o r R3
fl =1/(2* %pi * Ci *( Rif + Ro ) ) ; // lowf r e q c u t o f f
printf ( \n Lowf r e q c u t o f f i s = %. 1 f Hz \n , fl ) //
Result
K = Rf /( R1 + Rf ) ;
Af = - Rf / R1 ; // c l o s e d l o o p v o l t a g e g a i n
fh = UGB * K / abs ( Af ) ; // Highf r e q c u t o f f
printf ( \n Highf r e q c u t o f f i s = %. 1 f Hz \n , fh ) //
Result
BW = fh - fl ; // Bandwidth
printf ( \n Bandwidth i s = %. 1 f Hz \n , BW ) // R e s u l t
41
=50;
Ci =0.1*10^ -6; // C a p a c i t a n c e b /w 2 s t a g e s b e i n g
coupled
Ro = Rin ; // a c o u t p u t r e s i s t a n c e o f t h e 1 s t s t a g e
UGB =10^6; // U n i t y g a i n bandwidth
Vcc =15;
printf ( \n The i d e a l maximum o u t p u t v o l t a g e s w i n g i s
= %. f V pp \n , Vcc )
1
2
3
4
5
6
7
8
9
10
42
13 R =30; // Assume t h e v a l u e o f
internal resistance of
the inductor
14 Xl =2* %pi * fp * L ; // I n d u c t i v e r e a c t a n c e
15 Qcoil = Xl / R ; // F i g u r e o f m e r i t o f t h e c o i l
16 printf ( \n F i g u r e o f m e r i t o f t h e c o i l i s = %. 1 f \n
17
18
19
20
21
, Qcoil )
Rp =( Qcoil ) ^2* R ; // P a r a l l e l r e s i s t a n c e o f t h e t a n k
circuit
printf ( \n P a r a l l e l r e s i s t a n c e o f t h e t a n k c i r c u i t
i s = %. 1 f ohm \n , Rp )
R1 =100; // Assume t h e v a l u e o f i n t e r n a l r e s i s r a n c e
of the c o i l
Rf = - Rp /(1 -( Rp /( Af * R1 ) ) ) ; // S i m p l i f y i n g Af=( Rf | | Rp ) /
R1
printf ( \n F eedback r e s i s t a n c e i s = %. 1 f ohm \n , Rf )
voltage
10 printf ( \n Output v o l t a g e i s = %. f V \n , Vo )
43
terminal
10 printf ( \n V o l t a g e a t noni n v e r t i n g t e r m i n a l i s = %.
f V \n , V1 )
11 Vo =(1+ Rf / R1 ) * V1 ; // Output v o l t a g e
12 printf ( \n Output v o l t a g e i s = %. f V \n , Vo )
44
in volts
10
printf ( \n Output v o l t a g e i s = %. f V \n , Vo )
=100*10^3;
8 Vdc =5;
9 Rt =100*10^3; // R e s i s t a n c e o f a t h e r m i s t o r
10 temp_coeff =1*10^3;
11
12 // Output v o l t a g e a t 0 d e g r e e
13 delta_R = - temp_coeff *(0 -25) ; // Change i n r e s i s t a n c e
14 R = Ra ; // Ra=Rb=Rc=R
15 Vo =(( Rf * delta_R ) /( R1 *4* R ) ) * Vdc ;
16 printf ( \n Output v o l t a g e a t 0 d e g r e e i s = %. 2 f V \n
, Vo )
17
18
19
// Output v o l t a g e a t 100 d e g r e e
delta_R = - temp_coeff *(100 -25) ; // Change i n
resistance
20 Vo =(( Rf * delta_R ) /( R1 *4* R ) ) * Vdc ;
21 printf ( \n Output v o l t a g e a t 100 d e g r e e i s = %. 2 f V
\n , Vo )
45
amplifier
8 Ra =100; Rb =100; Rc =100;
9 Vdc =10; Vo =1;
10 R = Ra ; // Ra=Rb=Rc=R
11 delta_R =( Vo * R ) /( Vdc * abs ( A ) ) ; // Change i n r e s i s t a n c e
12 printf ( \n Change i n r e s i s t a n c e i s = %. 1 f ohm \n ,
delta_R )
46
. 1 f \n ,A )
rectification
vin_min =1.1* R1min * io ; //
printf ( \n Minimum i n p u t
vin_min )
vin_max =1.1* R1max * io ; //
printf ( \n Maximum i n p u t
vin_max )
f u l l wave
Minimum i n p u t v o l t a g e
v o l t a g e i s = %. 1 f V \n ,
Maximum i n p u t v o l t a g e
v o l t a g e i s = %. 2 f V \n ,
//
//
//
//
Chapter6
Page . No222 , F i g u r e . No 6.18
Example 6 11
C u r r e n t and v o l t a g e d r o p
47
5
6
7
8
9
10
11
12
// Given
clear ; clc ;
Vin =0.5; Vo =1.2;
R1 =100;
Io = Vin / R1 ; // C u r r e n t t h r o u g h d i o d e
printf ( \n C u r r e n t t h r o u g h d i o d e i s = %. 4 f A \n , Io )
Vd = Vo - Vin ; // V o l t a g e d r o p a c r o s s d i o d e
printf ( \n V o l t a g e d r o p a c r o s s d i o d e i s = %. 1 f V \n
, Vd )
//
//
//
//
Chapter6
Page . No222 , F i g u r e . No 6.19
Example 6 12 b
Output v o l t a g e
48
5 // Given
6 clear ; clc ;
7 Vin =5; V1 =1;
8 R =10*10^3;
9 Vo =2* V1 ; // Output v o l t a g e
10 printf ( \n Output v o l t a g e i s = %. f V \n , Vo )
logic zero
Vo_min = Io * Rf ; // Minimum o u t p u t v o l t a g e
printf ( \n Minimum o u t p u t v o l t a g e i s = %. f V \n ,
Vo_min )
Io =( Vref / R1 )
*( 1/ 2+ 1/ 4+ 1/8 +1 /1 6+ 1/ 32+ 1/ 64 +1 /1 28+ 1/ 25 6) ;
Vo_max = Io * Rf ; // Maximum o u t p u t v o l t a g e
printf ( \n Maximum o u t p u t v o l t a g e i s = %. 2 f V \n ,
Vo_max )
1 // C h a p t e r 6
2 // Page . No228 , F i g u r e . No 6.21
3 // E x a m p l e 6 1 4
4 // Change i n o u t p u t v o l t a g e
5 // Given
6 clear ; clc ;
7 Rf =3*10^3;
8 Vdc =5;
9 Rt =100*10^3; // R e s i s t a n c e a t d a r k n e s s
10 Vomin = -( Vdc / Rt ) * Rf ; // Min o u t p u t v o l t a g e a t
11
12
13
14
darkness
printf ( \n Min o u t p u t v o l t a g e a t d a r k n e s s i s = %. 2 f
V \n , Vomin )
Rt =1.5*10^3; // R e s i s t a n c e a t I l l u m i n a t i o n
Vomax = -( Vdc / Rt ) * Rf ; // Max o u t p u t v o l t a g e a t
Illumination
printf ( \n Max o u t p u t v o l t a g e a t I l l u m i n a t i o n i s = %
. f V \n , Vomax )
// C h a p t e r 6
// Page . No230 , F i g u r e . No 6.23
// E x a m p l e 6 1 5
// Output v o l t a g e o f an i n t e g r a t o r
// Given
clear ; clc ;
Vin =2; // I n p u t v o l t a g e i n v o l t
Vo0 =0;
Vo1 = - integrate ( 2 , t ,0 ,1) ;
disp ( Vo1 )
Vo2 = - integrate ( 2 , t ,1 ,2) + Vo1 ;
disp ( Vo2 )
50
13
14
15
16
17
18
19
20
21
22
// C h a p t e r 6
// Page . No238
// E x a m p l e 6 1 6 a
// D e s i g n o f d i f f e r e n t i a t o r
// Given
clear ; clc ;
C1 =0.1*10^ -6; // Assume
fa =1*10^3; // Freq a t which g a i n i s 0 dB
Rf =1/(2* %pi * fa * C1 ) ; // U s i n g f a =1/(2 %pi Rf C1 )
printf ( \n F eedback r e s i s t a n c e i s = %. 1 f ohm \n , Rf )
Rf =1.5*10^3; // A p p r o x i m a t i o n
fb =20*10^3; // Gain l i m i t i n g f r e q
R1 =1/(2* %pi * fb * C1 ) ;
printf ( \n R e s i s t a n c e , R1 i s = %. 1 f ohm \n , R1 )
R1 =82; // A p p r o x i m a t i o n
Cf = R1 * C1 / Rf ;
printf ( \n C a p a c i t a n c e , Cf i s = %. 1 0 f f a r a d \n , Cf )
Cf =0.005*10^ -6; // A p p r o x i m a t i o n
51
of sine function
Vo = -1.5*10^3*0.1*10^ -6*2* %pi *10^3* dy ;
plot ( Vo ) ;
title ( Output V o l t a g e ) ;
xlabel ( t ) ;
ylabel ( Vo ) ;
52
Chapter 7
Active Filters and Oscillators
Result
printf ( \n Use 20 kohm POT a s R \n )
R1 =10*10^3; // Assumption
printf ( \n R e s i s t a n c e R1 i s = %. 1 f ohm \n , R1 )
Rf = R1 ; // S i c e p a s s b a n d g a i n i s 2 , R1 and Rf must be
equal
printf ( \n R e s i s t a n c e Rf i s = %. 1 f ohm \n , Rf )
53
// C h a p t e r 7
// Page . No256
// E x a m p l e 7 2
// D e s i g n o f low p a s s f i l t e r
// Given
clear ; clc ;
fc0 =1*10^3; // O r i g i n a l cut o f f f r e q u e n c y
fc1 =1.6*10^3; // New cut o f f f r e q u e n c y
R =15.9*10^3; // O r i g i n a l r e s i s t a n c e v a l u e
k = fc0 / fc1 ;
Rnew = R * k ;
printf ( \n New R e s i s t a n c e Rnew i s = %. 1 f ohm \n ,
Rnew ) // R e s u l t
54
8 fh =1000; // Cut o f f f r e q u e n c y
9 f1 =10; // I n p u t f r e q i n Hz
10 av1 = Af / sqrt (1+( f1 / fh ) ^2) ;
11 printf ( \n Gain m a g n i t u d e av1 a t f 1
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
av1 ) // R e s u l t
f2 =100; // Freq i n Hz
av2 = Af / sqrt (1+( f2 / fh ) ^2) ;
printf ( \n Gain m a g n i t u d e
av2 ) // R e s u l t
f3 =200; // Freq i n Hz
av3 = Af / sqrt (1+( f3 / fh ) ^2) ;
printf ( \n Gain m a g n i t u d e
av3 ) // R e s u l t
f4 =700; // Freq i n Hz
av4 = Af / sqrt (1+( f4 / fh ) ^2) ;
printf ( \n Gain m a g n i t u d e
av4 ) // R e s u l t
f5 =1000; // Freq i n Hz
av5 = Af / sqrt (1+( f5 / fh ) ^2) ;
printf ( \n Gain m a g n i t u d e
av5 ) // R e s u l t
f6 =3000; // Freq i n Hz
av6 = Af / sqrt (1+( f6 / fh ) ^2) ;
printf ( \n Gain m a g n i t u d e
av6 ) // R e s u l t
f7 =7000; // Freq i n Hz
av7 = Af / sqrt (1+( f7 / fh ) ^2) ;
printf ( \n Gain m a g n i t u d e
av7 ) // R e s u l t
f8 =10000; // Freq i n Hz
av8 = Af / sqrt (1+( f8 / fh ) ^2) ;
printf ( \n Gain m a g n i t u d e
av8 ) // R e s u l t
f9 =30000; // Freq i n Hz
av9 = Af / sqrt (1+( f9 / fh ) ^2) ;
printf ( \n Gain m a g n i t u d e
av9 ) // R e s u l t
f10 =100000; // Freq i n Hz
i s = %. 2 f \n ,
av2 a t f 2 i s = %. 2 f \n ,
av3 a t f 3 i s = %. 2 f \n ,
av4 a t f 4 i s = %. 2 f \n ,
av5 a t f 5 i s = %. 2 f \n ,
av6 a t f 6 i s = %. 2 f \n ,
av7 a t f 7 i s = %. 2 f \n ,
av8 a t f 8 i s = %. 2 f \n ,
av9 a t f 9 i s = %. 2 f \n ,
55
37
38
39
40
41
42
43
44
Scilab code Exa 7.4.a Design of second order low pass filter
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// C h a p t e r 7
// Page . No256
// E x a m p l e 7 4 a
// D e s i g n o f s e c o n d o r d e r low p a s s f i l t e r
// Given
clear ; clc ;
fh =1*10^3; // Cut o f f f r e q u e n c y
C2 =0.0047*10^ -6; // Assumption
C3 = C2 ;
R2 =1/(2* %pi * fh * C2 ) ;
printf ( \n R e s i s t a n c e R2 i s = %. 1 f ohm \n , R2 ) //
Result
R2 =33*10^3; // A p p r o x i m a t i o n
R3 = R2 ;
printf ( \n R e s i s t a n c e R3 i s = %. 1 f ohm \n , R3 ) //
Result
R1 =27*10^3; // Assumption
Rf =0.586* R1 ;
printf ( \n R e s i s t a n c e Rf i s = %. 1 f ohm \n , Rf ) //
Result
printf ( \n Use 20 kohm POT a s Rf \n )
56
Scilab code Exa 7.4.b Frequency response of second order highpass filter
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//
//
//
//
Chapter7
Page . No260
Example 7 4 b
Frequency r e s p o n s e o f second order highpass
filter
// Given
clear ; clc ;
Af =1.586; // Passband g a i n o f t h e f i l t e r
fh =1000; // Cut o f f f r e q u e n c y
f1 =10; // I n p u t f r e q i n Hz
av1 = Af / sqrt (1+( f1 / fh ) ^4) ;
printf ( \n Gain m a g n i t u d e av1 a t f 1 i s = %. 2 f \n ,
av1 ) // R e s u l t
f2 =100; // Freq i n Hz
av2 = Af / sqrt (1+( f2 / fh ) ^4) ;
printf ( \n Gain m a g n i t u d e av2 a t f 2 i s = %. 2 f \n ,
av2 ) // R e s u l t
f3 =200; // Freq i n Hz
av3 = Af / sqrt (1+( f3 / fh ) ^4) ;
printf ( \n Gain m a g n i t u d e av3 a t f 3 i s = %. 2 f \n ,
av3 ) // R e s u l t
f4 =700; // Freq i n Hz
av4 = Af / sqrt (1+( f4 / fh ) ^4) ;
printf ( \n Gain m a g n i t u d e av4 a t f 4 i s = %. 2 f \n ,
av4 ) // R e s u l t
f5 =1000; // Freq i n Hz
av5 = Af / sqrt (1+( f5 / fh ) ^4) ;
printf ( \n Gain m a g n i t u d e av5 a t f 5 i s = %. 2 f \n ,
av5 ) // R e s u l t
f6 =3000; // Freq i n Hz
57
i s = %. 2 f \n ,
av6 ) // R e s u l t
f7 =7000; // Freq i n Hz
av7 = Af / sqrt (1+( f7 / fh ) ^4) ;
printf ( \n Gain m a g n i t u d e av7 a t f 7 i s = %. 2 f \n ,
av7 ) // R e s u l t
f8 =10000; // Freq i n Hz
av8 = Af / sqrt (1+( f8 / fh ) ^4) ;
printf ( \n Gain m a g n i t u d e av8 a t f 8 i s = %. 2 f \n ,
av8 ) // R e s u l t
f9 =30000; // Freq i n Hz
av9 = Af / sqrt (1+( f9 / fh ) ^4) ;
printf ( \n Gain m a g n i t u d e av9 a t f 9 i s = %. 5 f \n ,
av9 ) // R e s u l t
f10 =100000; // Freq i n Hz
av10 = Af / sqrt (1+( f10 / fh ) ^4) ;
printf ( \n Gain m a g n i t u d e av10 a t f 1 0 i s = %. 6 f \n ,
av10 ) // R e s u l t
x =[ f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 ];
y =[ av1 av2 av3 av4 av5 av6 av7 av8 av9 av10 ];
gainplot (x , y ) ;
title ( F r e q u e n c y R e s p o n s e ) ;
xlabel ( F r e q u e n c y ( Hz ) ) ;
ylabel ( V o l t a g e g a i n ( dB ) ) ;
//
//
//
//
//
Chapter7
Page . No263
Example 7 5 a
Design of highpass f i l t e r
Given
58
6
7
8
9
10
11
12
13
14
15
16
clear ; clc ;
fh =1*10^3; // Cut o f f f r e q u e n c y
Af =2; // Passband g a i n o f t h e f i l t e r
C =0.01*10^ -6; // Assumption
R =1/(2* %pi * fh * C ) ;
printf ( \n R e s i s t a n c e R i s = %. 1 f ohm \n ,R ) //
Result
printf ( \n Use 20 kohm POT a s R \n )
R1 =10*10^3; // Assumption
printf ( \n R e s i s t a n c e R1 i s = %. 1 f ohm \n , R1 )
Rf = R1 ; // S i c e p a s s b a n d g a i n i s 2 , R1 and Rf must be
equal
printf ( \n R e s i s t a n c e Rf i s = %. 1 f ohm \n , Rf )
// C h a p t e r 7
// Page . No263
// E x a m p l e 7 5 b
// F r e q u e n c y r e s p o n s e o f h i g h p a s s f i l t e r
// Given
clear ; clc ;
Af =2; // Passband g a i n o f t h e f i l t e r
fl =1000; // Cut o f f f r e q u e n c y
f1 =100; // I n p u t f r e q i n Hz
av1 =( Af *( f1 / fl ) ) / sqrt (1+( f1 / fl ) ^2) ;
printf ( \n Gain m a g n i t u d e av1 a t f 1 i s = %. 2 f \n ,
av1 ) // R e s u l t
f2 =200; // Freq i n Hz
av2 =( Af *( f2 / fl ) ) / sqrt (1+( f2 / fl ) ^2) ;
printf ( \n Gain m a g n i t u d e av2 a t f 2 i s = %. 2 f \n ,
av2 ) // R e s u l t
f3 =400; // Freq i n Hz
59
av3 ) // R e s u l t
f4 =700; // Freq i n Hz
av4 =( Af *( f4 / fl ) ) / sqrt (1+( f4 / fl ) ^2) ;
printf ( \n Gain m a g n i t u d e av4 a t f 4 i s = %. 2 f \n ,
av4 ) // R e s u l t
f5 =1000; // Freq i n Hz
av5 =( Af *( f5 / fl ) ) / sqrt (1+( f5 / fl ) ^2) ;
printf ( \n Gain m a g n i t u d e av5 a t f 5 i s = %. 2 f \n ,
av5 ) // R e s u l t
f6 =3000; // Freq i n Hz
av6 =( Af *( f6 / fl ) ) / sqrt (1+( f6 / fl ) ^2) ;
printf ( \n Gain m a g n i t u d e av6 a t f 6 i s = %. 2 f \n ,
av6 ) // R e s u l t
f7 =7000; // Freq i n Hz
av7 =( Af *( f7 / fl ) ) / sqrt (1+( f7 / fl ) ^2) ;
printf ( \n Gain m a g n i t u d e av7 a t f 7 i s = %. 2 f \n ,
av7 ) // R e s u l t
f8 =10000; // Freq i n Hz
av8 =( Af *( f8 / fl ) ) / sqrt (1+( f8 / fl ) ^2) ;
printf ( \n Gain m a g n i t u d e av8 a t f 8 i s = %. 2 f \n ,
av8 ) // R e s u l t
f9 =30000; // Freq i n Hz
av9 =( Af *( f9 / fl ) ) / sqrt (1+( f9 / fl ) ^2) ;
printf ( \n Gain m a g n i t u d e av9 a t f 9 i s = %. 2 f \n ,
av9 ) // R e s u l t
f10 =100000; // Freq i n Hz
av10 =( Af *( f10 / fl ) ) / sqrt (1+( f10 / fl ) ^2) ;
printf ( \n Gain m a g n i t u d e av10 a t f 1 0 i s = %. 2 f \n ,
av10 ) // R e s u l t
x =[ f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 ];
y =[ av1 av2 av3 av4 av5 av6 av7 av8 av9 av10 ];
gainplot (x , y ) ;
title ( F r e q u e n c y R e s p o n s e ) ;
xlabel ( F r e q u e n c y ( Hz ) ) ;
ylabel ( V o l t a g e g a i n ( dB ) ) ;
60
// C h a p t e r 7
// Page . No264
// E x a m p l e 7 6
// D e t e r m i n a t i o n o f low c u t o f f f r e q u e n c y
// Given
clear ; clc ;
R2 =33*10^3;
R3 = R2 ;
C2 =0.0047*10^ -6;
C3 = C2 ;
fl =1/(2* %pi * sqrt ( R2 * R3 * C2 * C3 ) ) ;
printf ( \n Low c u t o f f f r e q f l i s = %. 1 f Hz \n , fl )
// R e s u l t
Scilab code Exa 7.6.b Frequency response of second order highpass filter
1
2
3
4
5
6
7
8
9
//
//
//
//
Chapter7
Page . No264
Example 7 6 b
Frequency r e s p o n s e o f second order highpass
filter
// Given
clear ; clc ;
Af =1.586; // Passband g a i n o f t h e f i l t e r
fl =1000; // Cut o f f f r e q u e n c y
f1 =100; // I n p u t f r e q i n Hz
61
%. 5 f \n ,
12
13
14
%. 4 f \n ,
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
is =
av1 ) // R e s u l t
f2 =200; // Freq i n Hz
av2 = Af / sqrt (1+( fl / f2 ) ^4) ;
printf ( \n Gain m a g n i t u d e av2 a t f 2 i s =
av2 ) // R e s u l t
f3 =700; // Freq i n Hz
av3 = Af / sqrt (1+( fl / f3 ) ^4) ;
printf ( \n Gain m a g n i t u d e av3 a t f 3 i s =
av3 ) // R e s u l t
f4 =1000; // Freq i n Hz
av4 = Af / sqrt (1+( fl / f4 ) ^4) ;
printf ( \n Gain m a g n i t u d e av4 a t f 4 i s =
av4 ) // R e s u l t
f5 =3000; // Freq i n Hz
av5 = Af / sqrt (1+( fl / f5 ) ^4) ;
printf ( \n Gain m a g n i t u d e av5 a t f 5 i s =
av5 ) // R e s u l t
f6 =7000; // Freq i n Hz
av6 = Af / sqrt (1+( fl / f6 ) ^4) ;
printf ( \n Gain m a g n i t u d e av6 a t f 6 i s =
av6 ) // R e s u l t
f7 =10000; // Freq i n Hz
av7 = Af / sqrt (1+( fl / f7 ) ^4) ;
printf ( \n Gain m a g n i t u d e av7 a t f 7 i s =
av7 ) // R e s u l t
f8 =30000; // Freq i n Hz
av8 = Af / sqrt (1+( fl / f8 ) ^4) ;
printf ( \n Gain m a g n i t u d e av8 a t f 8 i s =
av8 ) // R e s u l t
f9 =100000; // Freq i n Hz
av9 = Af / sqrt (1+( fl / f9 ) ^4) ;
printf ( \n Gain m a g n i t u d e av9 a t f 9 i s =
av9 ) // R e s u l t
x =[ f1 f2 f3 f4 f5 f6 f7 f8 f9 ];
y =[ av1 av2 av3 av4 av5 av6 av7 av8 av9 ];
gainplot (x , y ) ;
62
%. 4 f \n ,
%. 4 f \n ,
%. 4 f \n ,
%. 4 f \n ,
%. 4 f \n ,
%. 4 f \n ,
%. 4 f \n ,
39
40
41
title ( F r e q u e n c y R e s p o n s e ) ;
xlabel ( F r e q u e n c y ( Hz ) ) ;
ylabel ( V o l t a g e g a i n ( dB ) ) ;
// C h a p t e r 7
// Page . No270
// E x a m p l e 7 7 a
// D e s i g n o f w i d e b a n d p a s s f i l t e r
// Given
clear ; clc ;
fl =200; // Low c u t o f f f r e q i n Hz
fh =1*10^3; // High c u t o f f f r e q i n Hz
C1 =0.01*10^ -6; // Assumption
R1 =1/(2* %pi * fh * C1 ) ;
printf ( \n R e s i s t a n c e R1 i s = %. 1 f ohm \n , R1 ) //
Result
C =0.05*10^ -6;
R =1/(2* %pi * fl * C ) ;
printf ( \n R e s i s t a n c e R i s = %. 1 f ohm \n , R ) //
Result
printf ( \n Bandpass Gain Af i s = 4 \n ) // S i n c e
g a i n o f h i g h p a s s and l o w p a s s i s s e t t o 2
R1 =10*10^3; // Assumption
printf ( \n R e s i s t a n c e R1 i s = %. 1 f ohm \n , R1 )
Rf = R1 ; // S i c e p a s s b a n d g a i n i s 2 , R1 and Rf must be
equal
printf ( \n R e s i s t a n c e Rf i s = %. 1 f ohm \n , Rf )
63
// C h a p t e r 7
// Page . No270
// E x a m p l e 7 7 b
// F r e q u e n c y r e s p o n s e o f b a n d p a s s f i l t e r
// Given
clear ; clc ;
Aft =4; // Passband g a i n o f t h e f i l t e r
fl =200; // Lower Cut o f f f r e q u e n c y
fh =1000; // H i g h e r Cut o f f f r e q u e n c y
f1 =10; // I n p u t f r e q i n Hz
av1 =( Aft *( f1 / fl ) ) / sqrt ((1+( f1 / fl ) ^2) *(1+( f1 / fh ) ^2) ) ;
printf ( \n Gain m a g n i t u d e av1 a t f 1 i s = %. 4 f \n ,
av1 ) // R e s u l t
f2 =30; // Freq i n Hz
av2 =( Aft *( f2 / fl ) ) / sqrt ((1+( f2 / fl ) ^2) *(1+( f2 / fh ) ^2) ) ;
printf ( \n Gain m a g n i t u d e av2 a t f 2 i s = %. 4 f \n ,
av2 ) // R e s u l t
f3 =100; // Freq i n Hz
av3 =( Aft *( f3 / fl ) ) / sqrt ((1+( f3 / fl ) ^2) *(1+( f3 / fh ) ^2) ) ;
printf ( \n Gain m a g n i t u d e av3 a t f 3 i s = %. 4 f \n ,
av3 ) // R e s u l t
f4 =200; // Freq i n Hz
av4 =( Aft *( f4 / fl ) ) / sqrt ((1+( f4 / fl ) ^2) *(1+( f4 / fh ) ^2) ) ;
printf ( \n Gain m a g n i t u d e av4 a t f 4 i s = %. 4 f \n ,
av4 ) // R e s u l t
f5 =447.2; // Freq i n Hz
av5 =( Aft *( f5 / fl ) ) / sqrt ((1+( f5 / fl ) ^2) *(1+( f5 / fh ) ^2) ) ;
printf ( \n Gain m a g n i t u d e av5 a t f 5 i s = %. 4 f \n ,
av5 ) // R e s u l t
f6 =700; // Freq i n Hz
64
av6 ) // R e s u l t
f7 =1000; // Freq i n Hz
av7 =( Aft *( f7 / fl ) ) / sqrt ((1+( f7 / fl ) ^2) *(1+( f7 / fh ) ^2) ) ;
printf ( \n Gain m a g n i t u d e av7 a t f 7 i s = %. 4 f \n ,
av7 ) // R e s u l t
f8 =2000; // Freq i n Hz
av8 =( Aft *( f8 / fl ) ) / sqrt ((1+( f8 / fl ) ^2) *(1+( f8 / fh ) ^2) ) ;
printf ( \n Gain m a g n i t u d e av8 a t f 8 i s = %. 4 f \n ,
av8 ) // R e s u l t
f9 =7000; // Freq i n Hz
av9 =( Aft *( f9 / fl ) ) / sqrt ((1+( f9 / fl ) ^2) *(1+( f9 / fh ) ^2) ) ;
printf ( \n Gain m a g n i t u d e av9 a t f 9 i s = %. 4 f \n ,
av9 ) // R e s u l t
f10 =10000; // Freq i n Hz
av10 =( Aft *( f10 / fl ) ) / sqrt ((1+( f10 / fl ) ^2) *(1+( f10 / fh )
^2) ) ;
printf ( \n Gain m a g n i t u d e av10 a t f 1 0 i s = %. 4 f \n ,
av10 ) // R e s u l t
x =[ f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 ];
y =[ av1 av2 av3 av4 av5 av6 av7 av8 av9 av10 ];
gainplot (x , y ) ;
title ( F r e q u e n c y R e s p o n s e ) ;
xlabel ( F r e q u e n c y ( Hz ) ) ;
ylabel ( V o l t a g e g a i n ( dB ) ) ;
//
//
//
//
Chapter7
Page . No270
Example 7 7 c
Calculation of quality factor
65
5 // Given
6 clear ; clc ;
7 fh =1*10^3; // H i g h e r cut o f f f r e q u e n c y
8 fl =200; // Lower cut o f f f r e q u e n c y
9 fc = sqrt ( fl * fh ) ; // C e n t e r f r e q u e n c y
10 printf ( \n C e n t e r f r e q u e n c y f c i s = %. 1 f Hz \n , fc )
// R e s u l t
11 Q = fc /( fh - fl ) ; // Q u a l i t y f a c t o r
12 printf ( \n Q u a l i t y f a c t o r Q i s = %. 2 f
\n ,Q ) //
Result
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
66
// R e s u l t
// C h a p t e r 7
// Page . No274
// E x a m p l e 7 9
// D e s i g n o f w i d e b a n d r e j e c t f i l t e r
// Given
clear ; clc ;
fh =200; // Low c u t o f f f r e q i n Hz
fl =1*10^3; // High c u t o f f f r e q i n Hz
C2 =0.01*10^ -6; // Assumption
R2 =1/(2* %pi * fl * C2 ) ;
67
11
12
13
14
15
16
17
18
19
printf ( \n R e s i s t a n c e R2 o f h i g h p a s s s e c t i o n i s = %
. 1 f ohm \n , R2 ) // R e s u l t
C =0.05*10^ -6;
R =1/(2* %pi * fh * C ) ;
printf ( \n R e s i s t a n c e R o f l o w p a s s s e c t i o n i s = %. 1 f
ohm \n , R ) // R e s u l t
printf ( \n Bandpass Gain Af i s = 4 \n ) // S i n c e
g a i n o f h i g h p a s s and l o w p a s s i s s e t t o 2
R1 =10*10^3; // Assumption
printf ( \n R e s i s t a n c e R1 i s = %. 1 f ohm \n , R1 )
Rf = R1 ; // S i n c e p a s s b a n d g a i n i s 2 , R1 and Rf must be
equal
printf ( \n R e s i s t a n c e Rf i s = %. 1 f ohm \n , Rf )
Result
1
2
3
4
5
6
7
8
9
10
11
// C h a p t e r 7
// Page . No279
// E x a m p l e 7 1 1
// Phase a n g l e
// Given
clear ; clc ;
f =1*10^3; // I n p u t f r e q u e n c y i n Hz
C =0.01*10^ -6;
R =15.9*10^3;
phi = -2* atand (2* %pi * f * C * R ) ; // Phase a n g l e
printf ( \n Phase a n g l e p h i i s = %. f deg \n , phi ) //
Result
Result
printf ( \n Use R e s i s t a n c e R a s 3 . 3 kohm \n )
R =3.3*10^3;
R1 =10* R ; // To p r e v e n t l o a d i n g o f a m p l i f i e r
Rf =29* R1 ;
printf ( \n R e s i s t a n c e Rf i s = %. 1 f ohm \n , Rf ) //
Result
69
Result
11 R1 =12*10^3; // Assumption
12 Rf =2* R1 ;
13 printf ( \n R e s i s t a n c e Rf i s = %. 1 f ohm \n , Rf ) //
Result
70
9 R =0.159/( fo * C ) ;
10 printf ( \n R e s i s t a n c e
v a l u e s R1 , R2 , R3 i s = %. 1 f ohm
\n ,R ) // R1=R2=R3=R
11 printf ( \n C a p a c i t a n c e v a l u e s C1 , C2 , C3 i s = %. 8 f
f a r a d \n ,C ) // C1=C2=C3=C
1
2
3
4
5
6
7
8
9
10
11
// C h a p t e r 7
// Page . No291
// E x a m p l e 7 1 6
71
4
5
6
7
8
9
10
11
12
13
14
15
16
// D e s i g n o f t r i a n g u l a r wave g e n e r a t o r
// Given
clear ; clc ;
fo =2*10^3; // F r e q u e n c y o f o s c i l l a t i o n
vo =7; // Output v o l t a g e
Vsat =14; // S a t u r a t i o n v o l t a g e f o r opamp 1 4 5 8
R3 =40*10^3; // Assumption
R2 =( vo * R3 ) /(2* Vsat ) ;
printf ( \n R e s i s t a n c e R2 i s = %. 1 f ohm \n , R2 ) //
Result
k = R3 /(4* fo * R2 ) ; // U s i n g f o=R3 / ( 4 R1C1R2 ) , k=R1C1 ;
C1 =0.05*10^ -6; // Assumption
R1 = k / C1 ;
printf ( \n R e s i s t a n c e R1 i s = %. 1 f ohm \n , R1 ) //
Result
72
15
// C h a p t e r 7
// Page . No296
// E x a m p l e 7 1 7 b
// M o d u l a t i o n i n o u t p u t f r e q u e n c y
// Given
clear ; clc ;
R2 =1.5*10^3;
R1 =10*10^3;
R3 =10*10^3;
C1 =0.001*10^ -6;
V =12; // S u p p l y v o l t a g e
Vc1 =9.5;
Vc2 =11.5;
fo1 =2*( V - Vc1 ) /( V * R1 * C1 ) ;
printf ( \n Approximate Nominal f r e q f o 1 i s = %. 1 f Hz
\n , fo1 ) // R e s u l t
fo2 =2*( V - Vc2 ) /( V * R1 * C1 ) ;
printf ( \n Approximate Nominal f r e q f o 2 i s = %. 1 f Hz
\n , fo2 ) // R e s u l t
delta_fo = fo1 - fo2 ; // Change i n o u t p u t f r e q
printf ( \n Change i n o u t p u t f r e q d e l t a f o i s = %. 1 f
Hz \n , delta_fo ) // R e s u l t
73
Chapter 8
Comparators and Converters
voltage
printf ( \n Upper t h r e s h o l d v o l t a g e i s = %. 4 f V \n ,
Vut ) // R e s u l t
Vlt =( R1 /( R1 + R2 ) ) *( neg_Vsat ) ; // Lower t h r e s h o l d
voltage
printf ( \n Lower t h r e s h o l d v o l t a g e i s = %. 4 f V \n ,
Vlt ) // R e s u l t
t =0:0.1:2* %pi ;
vut =0.5* sin ( t ) ;
subplot (2 ,1 ,1) ;
74
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
plot (t , vut ) ;
title ( I n p u t V o l t a g e ) ;
xlabel ( t ) ;
ylabel ( Vin ) ;
c =0;
for i =0:0.1:2* %pi
c = c +1;
end
for i =1: c ;
if vut ( i ) >0.025
v ( i ) = -14;
else if vut ( i ) < -0.025
v ( i ) =14;
end
end
end
subplot (2 ,1 ,2) ;
plot (t , v ) ;
title ( Output Waveform ) ;
xlabel ( t ) ;
ylabel ( Vo ) ;
75
positive half
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
c y c l e of the input
Vd2 =5.1; // Output v o l t a g e d u r i n g n e g a t i v e h a l f
c y c l e of the input
printf ( \n Output v o l t a g e d u r i n g p o s i t i v e h a l f c y c l e
o f t h e i n p u t i s = %. 1 f V \n , Vd1 ) // S i n c e z e n e r
diode i s forward biased
printf ( \n Output v o l t a g e d u r i n g n e g a t i v e h a l f c y c l e
o f t h e i n p u t i s = %. 1 f V \n , Vd2 ) // S i n c e z e n e r
d i o d e i s r e v e r s e b i a s e d
t =0:0.1:2* %pi ;
vut =0.5* sin ( t ) ;
subplot (2 ,1 ,1) ;
plot (t , vut ) ;
title ( I n p u t V o l t a g e ) ;
xlabel ( t ) ;
ylabel ( Vin ) ;
c =1;
for t =0:0.1:2* %pi
if t < %pi
v ( c ) = -0.7;
else
v ( c ) =5.1;
end
c = c +1;
subplot (2 ,1 ,2) ;
plot ( v ) ;
end
title ( Output Waveform ) ;
xlabel ( t ) ;
ylabel ( Vo ) ;
76
1 // C h a p t e r 8
2 // Page . No320 , F i g u r e . No 8.12
3 // E x a m p l e 8 3
4 // Output f r e q u e n c i e s
5 // Given
6 clear ; clc ;
7 Vin =2; // I n p u t v o l t a g e
8 Fo1 =2*10^3; // Output f r e q Fo when Vin=2V
9 Fo2 =1*10^3; // Output f r e q Fo /2 when Vin=2V
10 printf ( \n Output f r e q Fo i s = %. f Hz \n , Fo1 ) //
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
Result
printf ( \n Output f r e q Fo /2 i s = %. f Hz \n , Fo2 ) //
Result
count =1;
for i =1:50;
// f o r 5 c y c l e s
if count <4;
v ( i ) =5;
else
v ( i ) =0;
end
if count <10
count = count +1;
else
count =1;
end
end
subplot (2 ,1 ,1) ;
plot ( v ) ;
title ( Output Waveform ) ;
xlabel ( t ( m i c r o s e c ) ) ;
ylabel ( P u l s e f r e q o u t p u t , Fo (V) ) ;
for i =1:50;
// f o r 5 c y c l e s
if count <10;
v ( i ) =5;
else
v ( i ) =0;
end
if count <20
77
37
count = count +1;
38 else
39
count =1;
40 end
41 end
42 subplot (2 ,1 ,2) ;
43 plot ( v ) ;
44 title ( Output Waveform ) ;
45 xlabel ( t ( m i c r o s e c ) ) ;
46 ylabel ( P u l s e f r e q o u t p u t , Fo / 2 (V) ) ;
Result
// C h a p t e r 8
// Page . No335 , F i g u r e . No 8 . 2 5 ( a )
// E x a m p l e 8 5
78
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Output v o l t a g e
// Given
clear ; clc ;
vin =100*10^ -3;
t =0:0.1:2* %pi ;
i =1;
for t =0:0.1:2* %pi ;
if t <= %pi
v ( i ) = vin * sin ( t ) ;
else
v ( i ) =0;
end
i = i +1;
end
t =0:0.1:2* %pi ;
plot (t , v )
79
Chapter 9
Specialized IC Applications
Scilab code Exa 9.1 Second order inverting butterworth lowpass filter
1 // C h a p t e r 9
2 // Page . No387
3 // E x a m p l e 9 1
4 // S e c o n d o r d e r i n v e r t i n g b u t t e r w o r t h l o w p a s s f i l t e r
5 // Given
6 clear ; clc ;
7 dc_gain =5;
8 f1 =2*10^3; // C u t o f f f r e q i n Hz
9 Q =10; // F i g u r e o f m e r i t
10 R2 =(316*10^3) /10; // R e s i s t a n c e R2
11 printf ( \n R e s i s t a n c e R2 i s = %. 1 f ohm \n , R2 ) //
12
13
14
15
16
17
18
Result
R3 =(100*10^3) /((3.16* Q ) -1) ;
printf ( \n R e s i s t a n c e R3 i s
Result
printf ( \n R e s i s t a n c e R1 i s
R4 =(5.03*10^7) / f1 ;
printf ( \n R e s i s t a n c e R4 i s
Result
R5 = R4 ;
printf ( \n R e s i s t a n c e R5 i s
80
= %. 1 f ohm \n , R3 ) //
Open \n ) // R e s u l t
= %. 1 f ohm \n , R4 ) //
= %. 1 f ohm \n , R5 ) //
19
20
21
22
23
Result
R6 =1.8*10^3; // Assumption
R7 = dc_gain * R6 ;
printf ( \n R e s i s t a n c e R7 i s = %. 1 f ohm \n , R7 ) //
R e s u l t and i t s a p o t e n t i o m e t e r
R8 =( R6 * R7 ) /( R6 + R7 ) ;
printf ( \n R e s i s t a n c e R8 i s = %. 3 f ohm \n , R8 ) //
Result
Scilab code Exa 9.2 Second order inverting butterworth bandpass filter
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//
//
//
//
Chapter9
Page . No388
Example 9 2
Second o r d e r i n v e r t i n g b u t t e r w o r t h bandpass
filter
// Given
clear ; clc ;
f1 =5*10^3; // C e n t e r f r e q i n Hz
Q =10; // F i g u r e o f m e r i t
R2 =100*10^3; // C o n s t a n t f o r bandp a s s f i l t e r
printf ( \n R e s i s t a n c e R2 i s = %. 1 f ohm \n , R2 ) //
Result
R3 =(100*10^3) /((3.48* Q ) -1) ;
printf ( \n R e s i s t a n c e R3 i s = %. 1 f ohm \n , R3 ) //
Result
printf ( \n R e s i s t a n c e R1 i s Open \n ) // R e s u l t
R4 =(5.03*10^7) / f1 ;
printf ( \n R e s i s t a n c e R4 i s = %. 1 f ohm \n , R4 ) //
A p p r o x i m a t e l y 10 kohm
R5 = R4 ;
printf ( \n R e s i s t a n c e R5 i s = %. 1 f ohm \n , R5 ) //
A p p r o x i m a t e l y 10 kohm and i t s a p o t e n t i o m e t e r
81
Result
11 R3 =(100*10^3) /((3.48* Q ) -1) ;
12 printf ( \n R e s i s t a n c e R3 i s = %. 1 f ohm \n , R3 ) //
13
14
15
16
17
18
19
20
21
22
23
Result
printf ( \n R e s i s t a n c e R1 i s
R4 =(5.03*10^7) / f1 ;
printf ( \n R e s i s t a n c e R4 i s
A p p r o x i m a t e l y 10 kohm
R5 = R4 ;
printf ( \n R e s i s t a n c e R5 i s
A p p r o x i m a t e l y 10 kohm and
R6 =10*10^3; // Assumption
printf ( \n R e s i s t a n c e R6 i s
Result
R7 = R6 ;
printf ( \n R e s i s t a n c e R7 i s
Result
R8 = R6 ;
printf ( \n R e s i s t a n c e R8 i s
Result
82
Open \n ) // R e s u l t
= %. 1 f ohm \n , R4 ) //
= %. 1 f ohm \n , R5 ) //
i t s a potentiometer
= %. 1 f ohm \n , R6 ) //
= %. 1 f ohm \n , R7 ) //
= %. 1 f ohm \n , R8 ) //
24 R9 =( R6 * R7 * R8 ) /( R6 * R7 + R6 * R8 + R7 * R8 ) ; // S i n c e R6 | | R7 | |
25
R8
printf ( \n R e s i s t a n c e R9 i s = %. 1 f ohm \n , R9 ) //
Result
Result
12 Q =0.707; // F i g u r e o f m e r i t Q i s f i x e d f o r s e c o n d
o r d e r b u t t e r w o r t h lowp a s s f i l t e r
13 R3 = Q * R2 ; // U s i n g Q=R3/R2
14 printf ( \n R e s i s t a n c e R3 i s = %. 1 f ohm \n , R3 ) //
A p p r o x i m a t e l y 15 kohm
// C h a p t e r 9
// Page . No402 , F i g u r e . No 9 . 1 6 ( a )
83
3 // E x a m p l e 9 5
4 // V a l u e o f c a p a c i t o r
5 // Given
6 clear ; clc ;
7 Ra =10*10^3; // R e s i s t a n c e i n ohm
8 tp =10*10^ -3; // Output p u l s e w i d t h
9 C = tp /(1.1* Ra ) ;
10 printf ( \n C a p a c i t a n c e C i s = %. 9 f f a r a d \n ,C ) //
A p p r o x i m a t e l y 1uF
// C h a p t e r 9
// Page . No402 , F i g u r e . No 9 . 1 6 ( a )
// E x a m p l e 9 6
// V a l u e o f r e s i s t o r
// Given
clear ; clc ;
f =2*10^3; // Freq o f i n p u t t r i g g e r s i g n a l i n Hz
C =0.01*10^ -6;
tp =1.2/ f ;
Ra = tp /(1.1* C ) ;
printf ( \n R e s i s t a n c e Ra i s = %. 1 f ohm \n , Ra ) //
Result
// C h a p t e r 9
// Page . No402 , F i g u r e . No 9 . 2 1 ( a )
84
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// E x a m p l e 9 7
// V a l u e o f t c , t d and f 0
// Given
clear ; clc ;
Ra =2.2*10^3; // R e s i s t a n c e i n ohm
Rb =3.9*10^3; // R e s i s t a n c e i n ohm
C =0.1*10^ -6; // c a p a c i t a n c e i n f a r a d
tc =0.69*( Ra + Rb ) * C ; // C h a r g i n g t i m e o f t h e c a p a c i t o r
printf ( \n C h a r g i n g t i m e o f t h e c a p a c i t o r i s = %. 6 f
s e c \n , tc ) // R e s u l t
td =0.69* Rb * C ; // D i s c h a r g i n g t i m e o f t h e c a p a c i t o r
printf ( \n D i s c h a r g i n g t i m e o f t h e c a p a c i t o r i s = %
. 6 f s e c \n , td ) // R e s u l t
T = tc + td ;
fo =1/ T // Freq o f o s c i l l a t i o n
printf ( \n Freq o f o s c i l l a t i o n i s = %. 1 f Hz \n , fo )
// R e s u l t
// C h a p t e r 9
// Page . No412 , F i g u r e . No 9 . 2 4 ( a )
// E x a m p l e 9 8
// Freq o f f r e e r u n n i n g ramp g e n e r a t o r
// Given
clear ; clc ;
R =10*10^3; // R e s i s t a n c e i n ohm
Vcc =5 // S u p p l y v o l t a g e i n v o l t
Vbe =0.7 // Base t o e m i t t e r v o l t a g e i n v o l t
C =0.05*10^ -6; // C a p a c i t a n c e i n f a r a d
Ic =( Vcc - Vbe ) / R ; // C o l l e c t o r c u r r e n t i n ampere
fo =(3* Ic ) /( Vcc * C ) ;
printf ( \n Freq o f f r e e r u n n i n g ramp g e n e r a t o r i s =
85
%. 1 f Hz \n , fo ) // R e s u l t
Hz \n , fout ) // R e s u l t
14 V = V_plus - V_minus ;
15 fl =(8* fout ) / V ;
16 printf ( \n Lock r a n g e f r e q u e n c y o f VCO i s = %. 1 f Hz
\n , fl ) // R e s u l t
17 fc = sqrt ( fl /(2* %pi *3.6*10^3* C2 ) ) ;
18 printf ( \n C a p t u r e r a n g e f r e q u e n c y o f VCO i s = %. 2 f
Hz \n , fc ) // R e s u l t
// C h a p t e r 9
86
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Page . No440
// E x a m p l e 9 1 0
// D e s i g n o f c u r r e n t s o u r c e
// Given
clear ; clc ;
Vr =5; // V o l t a g e i n v o l t
Il =0.25; // Load c u r r e n t i n ampere
Rl =48; // Load r e s i s t a n c e i n ohm
dropout_volt =2; // C o n s t a n t f o r IC7805C
R = Vr / Il ; // Approximate r e s u l t s i c e I q i s n e g l i g i b l e
i n t h e eq . I l =(Vr / I l )+I q where I q i s q u i e s c e n t
current
printf ( \n R e s i s t a n c e R i s = %. f ohm \n ,R ) //
Result
Vl = Rl * Il ;
Vo = Vr + Vl ;
printf ( \n Output v o l t a g e Vo i s = %. f V \n , Vo ) //
Result
Vin = Vo + dropout_volt ;
printf ( \n Min i n p u t v o l t a g e Vin i s = %. f V \n , Vin )
// R e s u l t
// C h a p t e r 9
// Page . No444
// E x a m p l e 9 1 1
// D e s i g n o f v o l t a g e r e g u l a t o r
// Given
clear ; clc ;
Vo_min =5; // Min o u t p u t v o l t a g e i n v o l t
Vo_max =12; // Max o u t p u t v o l t a g e i n v o l t
Vref =1.25; // R e f e r e n c e v o l t a g e i n v o l t
87
17
18
volt
10 Vin =12; // I n p u t v o l t a g e i n v o l t
11 Vs =1.1; // Output s a t u r a t i o n v o l t a g e i n v o l t
12 Vripple =50*10^ -3; // Output r i p p l e v o l t a g e i n v o l t
88
13 Vref =1.245; // R e f e r e n c e v o l t a g e i n v o l t
14 Vr2 =1.2; // V o l t a g e a c r o s s r e s i s t a n c e R2 i n v o l t
15 Ipk =2* Iomax ; // S e n s e c u r r e n t i n ampere
16 printf ( \n S e n s e c u r r e n t , I p k i s = %. f A \n , Ipk ) //
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Result
Rsc =0.33/ Ipk ; // S e n s e r e s i s t a n c e i n ohm
printf ( \n S e n s e r e s i s t a n c e , Rsc i s = %. 2 f ohm \n ,
Rsc ) // R e s u l t
K =( Vo + Vd ) /( Vin - Vs - Vo ) ; // K= t o n / t o f f
printf ( \n C o n s t a n t K = %. 2 f \n ,K ) // R e s u l t
printf ( \n i . e , t o n i s K t i m e s o f t o f f \n )
f =20*10^3; // Assuming o p e r a t i n g f r e q i n Hz
T =1/ f ;
toff = T /2.06; // U s i n g t o n+ t o f f =T and s u b s t i t u t i n g
f o r ton
printf ( \n OFF t i m e p e r i o d , t o f f i s = %. 8 f s e c \n ,
toff ) // R e s u l t
ton =1.06* toff ;
printf ( \n ON t i m e p e r i o d , t o n i s = %. 8 f s e c \n , ton )
// R e s u l t
Ct =45*10^ -5* toff ; // O s c i l l a t o r t i m i n g c a p a c i t a n c e
in farad
printf ( \n O s c i l l a t o r t i m i n g c a p a c i t a n c e , Ct i s = %
. 1 0 f F \n , Ct ) // R e s u l t
L =(( Vo + Vd ) / Ipk ) * toff ; // I n d u c t a n c e i n h e n r y
printf ( \n I n d u c t a n c e , L i s = %. 8 f H \n ,L ) // R e s u l t
Co = Ipk *(( ton + toff ) /(8* Vripple ) ) ; // Output
capacitance in farad
printf ( \n Output c a p a c i t a n c e , Co i s = %. 7 f F \n , Co )
// R e s u l t
I2 =0.1*10^ -3; // Assuming t h e c u r r e n t t h r o u g h R2
R2 = Vref / I2 ; // R e s i s t a n c e R2 i n ohm
printf ( \n R e s i s t a n c e R2 i s = %. 1 f ohm \n , R2 ) //
Result
R2 =12*10^3; // Taking a p p r o x i m a t e v a l u e
R1 =( R2 *( Vo - Vr2 ) ) / Vr2 ; // U s i n g Vr2=(R1Vo ) /R1+R2 ,
voltage divider rule
printf ( \n R e s i s t a n c e R1 i s = %. 1 f ohm \n , R1 ) //
89
Result
40 efficiency =(( Vin - Vs + Vd ) / Vin ) *( Vo /( Vo + Vd ) ) *100;
41 printf ( \n e f f i c i e n c y i s = %. 1 f \n , efficiency ) //
Result
volt
Vin =12; // I n p u t v o l t a g e i n v o l t
Vs =1.1; // Output s a t u r a t i o n v o l t a g e i n v o l t
Vripple =50*10^ -3; // Output r i p p l e v o l t a g e i n v o l t
Vref =1.245; // R e f e r e n c e v o l t a g e i n v o l t
Vr2 =1.2; // V o l t a g e a c r o s s r e s i s t a n c e R2 i n v o l t
Ipk =2* Iomax ; // S e n s e c u r r e n t i n ampere
printf ( \n S e n s e c u r r e n t , I p k i s = %. f A \n , Ipk ) //
Result
Rsc =0.33/ Ipk ; // S e n s e r e s i s t a n c e i n ohm
printf ( \n S e n s e r e s i s t a n c e , Rsc i s = %. 3 f ohm \n ,
Rsc ) // R e s u l t
K =( Vo + Vd ) /( Vin - Vs - Vo ) ; // K= t o n / t o f f
printf ( \n C o n s t a n t K = %. 2 f \n ,K ) // R e s u l t
printf ( \n i . e , t o n i s K t i m e s o f t o f f \n )
f =20*10^3; // Assuming o p e r a t i n g f r e q i n Hz
T =1/ f ;
90
24
25
26
27
28
29
30
31
32
33
91