op-amps and linear integrated circuits_r. a. gayakwad_2
TRANSCRIPT
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
1/92
Scilab Textbook Companion for
Op-Amps And Linear Integrated Circuits
by R. A. Gayakwad1
Created byAmar Ds
BEInstrumentation Engineering
Sri Jayachamarajendra College Of EngineeringCollege Teacher
Rathnnakara SCross-Checked by
TechPassion
August 10, 2013
1Funded by a grant from the National Mission on Education through ICT,http://spoken-tutorial.org/NMEICT-Intro. This Textbook Companion and Scilabcodes written in it can be downloaded from the ”Textbook Companion Project”section at the website http://scilab.in
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
2/92
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
1
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
3/92
Scilab numbering policy used in this document and the relation to theabove 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 particularExample of the above book)
For example, Exa 3.51 means solved example 3.51 of this book. Sec 2.3 meansa scilab code whose theory is explained in Section 2.3 of the book.
2
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
4/92
Contents
List of Scilab Codes 4
1 Introduction to Operational Amplifier 7
2 Interpretation of Data Sheets and Characteristics of an Opamp 11
3 An Opamp with Negative Feedback 14
4 The Practical Opamp 21
5 Frequency Response of an Opamp 37
6 General Linear Applications 40
7 Active Filters and Oscillators 53
8 Comparators and Converters 74
9 Specialized IC Applications 80
3
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
5/92
List of Scilab Codes
Exa 1.1.a Collector current and dc voltage . . . . . . . . . . . . 7Exa 1.1.b Voltage gain of the opamp . . . . . . . . . . . . . . . . 9Exa 1.1.c Input resistance of the opamp . . . . . . . . . . . . . . 9Exa 2.1.a Output voltage for Openloop differential amplifier . . 11Exa 2.1.b Output voltage for openloop differential amplifier . . . 12Exa 2.2.a Output voltage for inverting amplifier . . . . . . . . . 12Exa 2.2.b Output voltage for inverting amplifier . . . . . . . . . 13Exa 3.1 Parameters Of voltageseries feedback amplifier . . . . 14Exa 3.2 Parameters Of voltageseries feedback amplifier . . . . 15Exa 3.3 Parameters of Voltageshunt feedback amplifier . . . . 16Exa 3.4 Output voltage of voltage shunt feedback amplifier . . 17Exa 3.5.a Gain input resistance of the amplifier . . . . . . . . . 18Exa 3.5.b Output voltage of an Opamp . . . . . . . . . . . . . . 18
Exa 3.6.a Voltage gain and input resistance of the Opamp . . . . 19Exa 3.6.b Output voltage of the Opamp . . . . . . . . . . . . . . 20Exa 4.1 Design of Compensating Network . . . . . . . . . . . . 21Exa 4.2 Max Output offset voltage . . . . . . . . . . . . . . . . 22Exa 4.3 Design of input offset voltage compensating network . 22Exa 4.4.a Max Output offset voltage . . . . . . . . . . . . . . . . 23Exa 4.4.b Effect of input bias current . . . . . . . . . . . . . . . 24Exa 4.5.a Max Output offset voltage . . . . . . . . . . . . . . . . 24Exa 4.5.b Effect of input bias current . . . . . . . . . . . . . . . 25Exa 4.6 Max Output offset voltage . . . . . . . . . . . . . . . . 25Exa 4.7 Total Output offset voltage . . . . . . . . . . . . . . . 26
Exa 4.8.a Error voltage and output voltage . . . . . . . . . . . . 27Exa 4.8.b Error voltage and output voltage . . . . . . . . . . . . 28Exa 4.9.a Error voltage and output voltage . . . . . . . . . . . . 29Exa 4.9.b Output waveform . . . . . . . . . . . . . . . . . . . . 30
4
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
6/92
Exa 4.10.a Error voltage and output voltage . . . . . . . . . . . . 30
Exa 4.10.b Error voltage and output voltage . . . . . . . . . . . . 31Exa 4.11.a Output offset voltage . . . . . . . . . . . . . . . . . . 32Exa 4.11.b Output offset voltage . . . . . . . . . . . . . . . . . . 33Exa 4.12 Output ripple voltage . . . . . . . . . . . . . . . . . . 34Exa 4.13 Change in output offset voltage . . . . . . . . . . . . . 34Exa 4.14.a Output voltage . . . . . . . . . . . . . . . . . . . . . . 35Exa 4.14.b Output common mode voltage . . . . . . . . . . . . . 35Exa 5.1 Maximum gain . . . . . . . . . . . . . . . . . . . . . . 37Exa 5.2 Gain equation and break frequencies . . . . . . . . . . 38Exa 5.3 Stability of voltage follower . . . . . . . . . . . . . . . 38Exa 6.1 Bandwidth of the amplifier . . . . . . . . . . . . . . . 40
Exa 6.2.a Bandwidth of the amplifier . . . . . . . . . . . . . . . 41Exa 6.2.b Max output voltage swing . . . . . . . . . . . . . . . . 42Exa 6.3 Components of peak amplifier . . . . . . . . . . . . . . 42Exa 6.4 Output voltage . . . . . . . . . . . . . . . . . . . . . . 43Exa 6.5 Output voltage . . . . . . . . . . . . . . . . . . . . . . 44Exa 6.6 Output voltage . . . . . . . . . . . . . . . . . . . . . . 44Exa 6.7 Output voltage . . . . . . . . . . . . . . . . . . . . . . 45Exa 6.8 Change in resistance in straingage . . . . . . . . . . . 46Exa 6.9 Gain of the amplifier . . . . . . . . . . . . . . . . . . . 46Exa 6.10 Range of input voltage . . . . . . . . . . . . . . . . . . 47
Exa 6.11 Current and voltage drop . . . . . . . . . . . . . . . . 47Exa 6.12.a Load current . . . . . . . . . . . . . . . . . . . . . . . 48Exa 6.12.b Output voltage . . . . . . . . . . . . . . . . . . . . . . 48Exa 6.13 Range of output voltage . . . . . . . . . . . . . . . . . 49Exa 6.14 Change in output voltage . . . . . . . . . . . . . . . . 49Exa 6.15 Output voltage of an integrator . . . . . . . . . . . . . 50Exa 6.16.a Design of differentiator . . . . . . . . . . . . . . . . . 51Exa 6.16.b Output waveform of differentiator . . . . . . . . . . . 52Exa 7.1 Design of low pass filter . . . . . . . . . . . . . . . . . 53Exa 7.2 Design of low pass filter . . . . . . . . . . . . . . . . . 54Exa 7.3 Frequency response of low pass filter . . . . . . . . . . 54
Exa 7.4.a Design of second order low pass filter . . . . . . . . . . 56Exa 7.4.b Frequency response of second order highpass filter . . 57Exa 7.5.a Design of highpass filter . . . . . . . . . . . . . . . . . 58Exa 7.5.b Frequency response of highpass filter . . . . . . . . . . 59Exa 7.6.a Determination of low cutoff frequency . . . . . . . . . 61
5
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
7/92
Exa 7.6.b Frequency response of second order highpass filter . . 61
Exa 7.7.a Design of wide bandpass filter . . . . . . . . . . . . . . 63Exa 7.7.b Frequency response of bandpass filter . . . . . . . . . 64Exa 7.7.c Calculation of quality factor . . . . . . . . . . . . . . . 65Exa 7.8.a Design of narrow bandpass filter . . . . . . . . . . . . 66Exa 7.8.b Design of narrow bandpass filter . . . . . . . . . . . . 67Exa 7.9 Design of wide bandreject filter . . . . . . . . . . . . . 67Exa 7.10 Design of notch filter . . . . . . . . . . . . . . . . . . . 68Exa 7.11 Phase angle . . . . . . . . . . . . . . . . . . . . . . . . 68Exa 7.12 Design of phase shift oscillator . . . . . . . . . . . . . 69Exa 7.13 Design of wein bridge oscillator . . . . . . . . . . . . . 70Exa 7.14 Design of quadrature oscillator . . . . . . . . . . . . . 70
Exa 7.15 Design of squarewave oscillator . . . . . . . . . . . . . 71Exa 7.16 Design of triangular wave generator . . . . . . . . . . 71Exa 7.17.a Nominal frequency . . . . . . . . . . . . . . . . . . . . 72Exa 7.17.b Modulation in output frequency . . . . . . . . . . . . 73Exa 8.1 Threshold voltage . . . . . . . . . . . . . . . . . . . . 74Exa 8.2 Output voltage swing . . . . . . . . . . . . . . . . . . 75Exa 8.3 Output frequencies . . . . . . . . . . . . . . . . . . . . 76Exa 8.4 Output voltage . . . . . . . . . . . . . . . . . . . . . . 78Exa 8.5 Output voltage . . . . . . . . . . . . . . . . . . . . . . 78Exa 9.1 Second order inverting butterworth lowpass filter . . . 80
Exa 9.2 Second order inverting butterworth bandpass filter . . 81Exa 9.3 Design of notch filter . . . . . . . . . . . . . . . . . . . 82Exa 9.4 Second order butterworth lowpass filter . . . . . . . . 83Exa 9.5 Value of capacitor . . . . . . . . . . . . . . . . . . . . 83Exa 9.6 Value of resistor . . . . . . . . . . . . . . . . . . . . . 84Exa 9.7 Value of tc td and f0 . . . . . . . . . . . . . . . . . . . 84Exa 9.8 Freq of free running ramp generator . . . . . . . . . . 85Exa 9.9 Value of fout fl fc . . . . . . . . . . . . . . . . . . . . . 86Exa 9.10 Design of current source . . . . . . . . . . . . . . . . . 86Exa 9.11 Design of voltage regulator . . . . . . . . . . . . . . . 87Exa 9.12 Design of stepdown switching regulator . . . . . . . . 88
Exa 9.13 Design of stepdown switching regulator . . . . . . . . 90
6
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
8/92
Chapter 1
Introduction to Operational
Amplifier
Scilab code Exa 1.1.a Collector current and dc voltage
1 / / C h a p t e r 12 // Page . No−4 ,3 / / E x a mp l e 1 1 a , F i g u r e . No−1.24 / / C o l l e c t o r c u r r e nt and dc v o l t a g e5 // Given :6 clear ; clc ;
7 V c c = 6 ; V b e 5 = 0 . 7 ; V e e = 6 ; V b e 3 = 6 . 7 ; V b e 6 = 0 . 7 ; V b e 7 = 0 . 7 ; //V ol ta ge i n v o l t s
8 R c 1 = 6 . 7 * 1 0 ^ 3 ; // R e s i s t a n ce i n ohms9 I c 1 = rand () ;
10 V c 1 = V c c - R c 1 * I c 1 ;
11 V e 4 = V c 1 - V b e 5 ;
12 I 4 = ( V e 4 + V e e ) / ( 9 . 1 * 1 0 ^ 3 + 5 . 5 * 1 0 ^ 3 ) ;
13 V b 3 = 5 . 5 * 1 0 ^ 3 * I 4 - V e e ;
14 V e 3 = V b 3 - V b e 3 ;15 I e 3 = ( V e 3 + V b e 3 ) / 3 . 3 * 1 0 ^ 3 ;
16 I c 1 = 1 . 0 8 * 1 0 ^ - 3 / 2 . 7 6 5 ; // S i n ce I e 3 =2∗ I c 1 ,s u b s t i t u t i n g i n above e qu a ti o n a nd s i m p l i f y i n g
17 printf ( ” \n C o l l e c t o r c u rr e n t I c 1 i s = %. 5 f A \n” ,Ic1
7
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
9/92
) // R e su l t
18 V c 1 = V c c - R c 1 * I c 1 ;19 printf ( ” \n V o lt ag e Vc1 i s = %. 2 f V \n” , V c 1 ) //R e s u l t
20 V e 4 = V c 1 - V b e 5 ;
21 printf ( ” \n V o lt ag e Ve4 i s = %. 2 f V \n” , V e 4 ) //R e s u l t
22 I e 4 = ( V e 4 + V e e ) / ( 2 9 . 2 * 1 0 ^ 3 ) ;
23 printf ( ” \n C ur re nt I e 4 i s = %. 6 f A \n” , I e 4 ) //R e s u l t
24 I c 5 = I e 4 ;
25 printf ( ” \n C ur re nt I c 5 i s = %. 6 f A \n” , I c 5 ) //
R e s u l t26 Vc5=Vcc -3.8*10^3* Ic5;
27 printf ( ” \n V o lt ag e Vc5 i s = %. 2 f V \n” , V c 5 ) //R e s u l t
28 V e 6 = V c 5 - V b e 6 ;
29 printf ( ” \n V o lt ag e Ve6 i s = %. 2 f V \n” , V e 6 ) //R e s u l t
30 I e 6 = ( V e 6 + V e e ) / ( 1 5 * 1 0 ^ 3 ) ;
31 printf ( ” \n C ur re nt I e 6 i s = %. 6 f A \n” , I e 6 ) //R e s u l t
32 V e 7 = V e 6 + V b e 7 ;
33 printf ( ” \n V o lt ag e Ve7 i s = %. 2 f V \n” , V e 7 ) //R e s u l t
34 I 1 = ( V c c - V e 7 ) / 4 0 0 ;
35 printf ( ” \n C ur re nt I 1 i s = %. 6 f A \n” , I 1 ) // R e su l t36 I e 8 = I 1 ;
37 printf ( ” \n C ur re nt I e 8 i s = %. 6 f A \n” , I e 8 ) //R e s u l t
38 V e 8 = - V e e + 2 * 1 0 ^ 3 * I e 8 ;
39 printf ( ” \n V ol ta ge Ve8 a t t he o ut p ut t e rm i na l i s = %. 2 f V \n” , V e 8 ) // R e su l t
8
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
10/92
Scilab code Exa 1.1.b Voltage gain of the opamp
1 / / C h a p t e r 12 // Page . No−4 ,3 / / E x a mp l e 1 1 b , F i g u r e . No−1.24 / / V o l t a g e g a i n o f t h e opamp5 // Given :6 clear ; clc ;
7 I e 1 = 0 . 3 9 * 1 0 ^ - 3 ; I e 4 = 0 . 2 9 8 * 1 0 ^ - 3 ; I e 6 = 0 . 6 7 8 * 1 0 ^ - 3 ; //C u rr e nt i n amps
8 R c 1 = 6 . 7 * 1 0 ^ 3 ; R c 5 = 3 . 8 * 1 0 ^ 3 ; // R e s i s t a n ce i n ohms9 b e t a _ a c = 1 5 0 ;
10 r e 1 = ( 2 5 * 1 0 ^ - 3 ) / I e 1 ;11 r e 2 = r e 1 ;
12 r e 4 = ( 2 5 * 1 0 ^ - 3 ) / I e 4 ;
13 r e 5 = r e 4 ;
14 r e 6 = ( 2 5 * 1 0 ^ - 3 ) / I e 6 ;
15 k = ( R c 1 * 2 * b e t a _ a c * r e 4 ) / ( R c 1 + 2 * b e t a _ a c * r e 4 ) ;
16 A d 1 = k / r e 1 ;
17 printf ( ” \n V ol ta ge g ai n o f t he dual −i n p u t , b a l a n c e dout put − 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” , A d 1 )
// R e su l t18 k 1 = ( R c 5 * b e t a _ a c * ( r e 6 + 1 5 * 1 0 ^ 3 ) ) / ( R c 5 + b e t a _ a c * ( r e 6
+ 1 5 * 1 0 ^ 3 ) ) ;
19 A d 2 = k 1 / ( 2 * r e 5 ) ;
20 printf ( ” \n V ol ta ge g ai n o f t he dual −i n p u t , u n b a l a n c e dout put − 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 su l t21 A d = 8 2 . 5 5 * 2 2 . 6 ; // Us ing Ad=Ad1∗Ad222 printf ( ” \n O v e r a l l g ai n o f t he o p−amp i s = %. 2 f \n”
, A d ) // R e su l t
Scilab code Exa 1.1.c Input resistance of the opamp
9
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
11/92
1 / / C h a p t e r 1
2 // Page . No−4 ,3 / / E x a m pl e 1 1 c , F i g u r e . No−1.24 // I n pu t r e s i s t a n c e o f t he opamp5 // Given :6 clear ; clc ;
7 b e t a _ a c = 1 5 0 ;
8 r e 1 = 6 4 . 1 ; // R e s i s t a n ce i n ohms9 R i = 2 * b e t a _ a c * r e 1 ;
10 printf ( ” \n I np ut r e s i s t a n c e Ri i s = %. 1 f ohm \n” , R i )// R e su l t
10
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
12/92
Chapter 2
Interpretation of Data Sheets
and Characteristics of an
Opamp
Scilab code Exa 2.1.a Output voltage for Openloop differential amplifier
1 / / C h a p t e r 22 // Page . No−4 5 , F i g u r e . No−2.93 / / E x a m p l e 2 1 a4 / / Output v o l t a g e f o r open−l o o p d i f f e r e n t i a l
a m p l i f i e r5 // Given :6 clear ; clc ;
7 v i n 1 = 5 * 1 0 ^ - 6 ; v i n 2 = - 7 * 1 0 ^ - 6 ; // Both i n p u t v o l t a g e sa re i n v o l t s
8 A = 2 0 0 0 0 0 ; // V o lt ag e g a in9 v o = A * ( v i n 1 - v i n 2 ) ; // Output v o l t a g e i n v o l t s
10 printf ( ” \n Output v o l t a g e i s vo = %. 1 f V d c \n” , v o )
// R e su l t
11
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
13/92
Scilab code Exa 2.1.b Output voltage for openloop differential amplifier
1 / / C h a p t e r 22 // Page . No−4 5 , F i g u r e . No−2.93 //EXAMPLE 2 1 b4 / / Output v o l t a g e f o r open−l o o p d i f f e r e n t i a l
a m p l i f i e r5 // Given :6 clear ; clc ;
7 v i n 1 = 1 0 * 1 0 ^ - 3 ; v i n 2 = 2 0 * 1 0 ^ - 3 ; // Both i n pu t v o l t a g e sa re i n v o l t s
8 A = 2 0 0 0 0 0 ; // V o lt ag e g a in9 v o = A * ( v i n 1 - v i n 2 ) ; // Output v o l t ag e i n v o l t s
10 printf ( ” \n Output v o l t a g e i s vo = %. f V rms \n” , v o )// R e su l t
Scilab code Exa 2.2.a Output voltage for inverting amplifier
1 / / C h a p t e r 22 // Page . No−4 6 , F i g u r e . No−2.103 / / E x a m p l e 2 2 a4 // Output v o l t a g e f o r i n v e r t i n g a m p l i f i e r5 // Given :
6 clear ; clc ;7 v i n = 2 0 * 1 0 ^ - 3 ; // I np u t v o l t a g e i n v o l t s8 A = 2 0 0 0 0 0 ; // V o lt ag e g a in9 v o = - ( A * v i n ) ; // Output v o l t ag e i n v o l t s
12
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
14/92
10 printf ( ” \n Output v o l t a g e i s vo = %. f V \n” , v o ) //
R e s u l t
Scilab code Exa 2.2.b Output voltage for inverting amplifier
1 / / C h a p t e r 22 // Page . No−4 6 , F i g u r e . No−2.10
3 / / E x a m p l e 2 2 b4 // Output v o l t a g e f o r i n v e r t i n g a m p l i f i e r5 // Given :6 clear ; clc ;
7 v i n = - 5 0 * 1 0 ^ - 6 ; // I np u t v o l t a g e i n v o l t s8 A = 2 0 0 0 0 0 ; // V o lt ag e g a in9 v o = - ( A * v i n ) ; // Output v o l t ag e i n v o l t s
10 printf ( ” \n Output v o l t a g e i s vo = %. f V \n” , v o ) //R e s u l t
13
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
15/92
Chapter 3
An Opamp with Negative
Feedback
Scilab code Exa 3.1 Parameters Of voltageseries feedback amplifier
1 / / C h a pt e r32 // P age . No−7 5 , F i g u r e . No−3.23 / / E xa mp le 3 14 / / P ar am et er s o f v o lt a ge − s e r i e s f ee db ac k a m p l i f i e r5 / / G iv en6 clear ; clc ;
7 R 1 = 1 0 0 0 ; R f = 1 0 0 0 0 ;
8 A = 2 0 0 0 0 0 ; // Open−l oo p v o l t ag e g ai n9 R i = 2 * 1 0 ^ 6 ; // I np ut r e s i s t a n c e w it ho ut f ee db ac k
10 R o = 7 5 ; // Output r e s i s t a n c e w it ho ut f e ed b ac k11 f o = 5 ; // B reak f r e qu e n cy o f an Op−amp12 V s a t = 1 3 ; // S a t u r a ti o n v o l t ag e13 B = R 1 / ( R 1 + R f ) ; // Gain o f t he f ee db ac k c i r c u i t14 A f = A / ( 1 + A * B ) ; / / C l os e d−l oo p v o l t a g e g ai n
15 printf ( ” \n C l os ed −l oo p v o l t ag e g ai n i s Af = %. 2 f \n”, A f ) // R e su l t16 R i F = R i * ( 1 + A * B ) ; // I np ut r e s i s t a n c e w i th f ee db ac k17 printf ( ” \n I np u t r e s i s t a n c e w i t h f ee db ac k i s RiF = %
. 2 f ohms \n” , R i F ) // R e su l t
14
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
16/92
18 R o F = R o / ( 1 + A * B ) ; // Output r e s i s t a n c e w it h f e ed b ac k
19 printf ( ” \n O utput r e s i s t a n c e w it h f e ed b ac k i s RoF =%f ohms \n” , R o F ) // R e su l t20 f F = f o * ( 1 + A * B ) ; / / B an dwi dt h w i th f e e d b a c k21 printf ( ” \n B an dwidth w it h f e e d ba c k i s vo = %. 1 f Hz \
n” , f F ) // R e su l t22 V o o T = V s a t / ( 1 + A * B ) ; // T ot a l o ut p u t o f f s e t v o l t a ge
w it h f e e d ba c k23 printf ( ” \n T o ta l o ut pu t o f f s e t v o l t a g e w i th f ee db ac k
i s VooT = % f V \n” , V o o T ) // R e su l t
Scilab code Exa 3.2 Parameters Of voltageseries feedback amplifier
1 / / C h a pt e r32 // P age . No−8 3 , F i g u r e . No−3.73 / / E xa mp le 3 24 / / P ar am et er s o f v o lt a ge − s e r i e s f ee db ac k a m p l i f i e r5 / / G iv en
6 clear ; clc ;7 R 1 = 1 0 0 0 ; R f = 1 0 0 0 0 ;
8 A = 2 0 0 0 0 0 ; // Open−l oo p v o l t ag e g ai n9 R i = 2 * 1 0 ^ 6 ; // I np ut r e s i s t a n c e w it ho ut f ee db ac k
10 R o = 7 5 ; // Output r e s i s t a n c e w it ho ut f e ed b ac k11 f o = 5 ; // B reak f r e qu e n cy o f an Op−amp12 V s a t = 1 3 ; // S a t u r a ti o n v o l t ag e13 B = 1 ; // Gain o f t h e f e ed ba ck c i r c u i t and i t i s e q ua l
t o 1 f o r v o l t a g e f o l l o w e r14 A f = A / ( 1 + A * B ) ; / / C l os e d−l oo p v o l t a g e g ai n
15 printf ( ” \n C l os ed −l oo p v o l t ag e g ai n i s Af = %. f \n” ,Af ) // R e su l t16 R i F = R i * ( 1 + A * B ) ; // I np ut r e s i s t a n c e w i th f ee db ac k17 printf ( ” \n I np u t r e s i s t a n c e w i t h f ee db ac k i s RiF = %
. 1 f ohms \n” , R i F ) // R e su l t
15
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
17/92
18 R o F = R o / ( 1 + A * B ) ; // Output r e s i s t a n c e w it h f e ed b ac k
19 printf ( ” \n O utput r e s i s t a n c e w it h f e ed b ac k i s RoF =%f ohms \n” , R o F ) // R e su l t20 f F = f o * ( 1 + A * B ) ; / / B an dwi dt h w i th f e e d b a c k21 printf ( ” \n B an dwidth w it h f e e d ba c k i s vo = %. 1 f Hz \
n” , f F ) // R e su l t22 V o o T = V s a t / ( 1 + A * B ) ; // T ot a l o ut p u t o f f s e t v o l t a ge
w it h f e e d ba c k23 printf ( ” \n T o ta l o ut pu t o f f s e t v o l t a g e w i th f ee db ac k
i s VooT = % f V \n” , V o o T ) // R e su l t
Scilab code Exa 3.3 Parameters of Voltageshunt feedback amplifier
1 / / C h a pt e r32 // P age . No−8 6 , F i g u r e . No−3.83 / / E xa mp le 3 34 / / P ar am et er s o f v o lt a ge −s hu nt f ee db ac k a m p l i f i e r5 / / G iv en
6 clear ; clc ;7 R 1 = 4 7 0 ; R f = 4 . 7 * 1 0 ^ 3 ;
8 A = 2 0 0 0 0 0 ; // Open−l oo p v o l t ag e g ai n9 R i = 2 * 1 0 ^ 6 ; // I np ut r e s i s t a n c e w it ho ut f ee db a ck
10 R o = 7 5 ; // Output r e s i s t a n c e w it ho ut f e ed b ac k11 f o = 5 ; // B reak f r e qu e n cy o f an Op−amp12 V s a t = 1 3 ; // S a t u r a ti o n v o l t ag e13 K = R f / ( R 1 + R f ) ; // V ol ta ge a t t en u a ti o n f a c t o r14 B = R 1 / ( R 1 + R f ) ; // Gain o f t he f ee db ac k c i r c u i t15 A f = - ( A * K ) / ( 1 + A * B ) ; / / C l os e d−l oo p v o l t a g e g ai n
16 printf ( ” \n C l os ed −l oo p v o l t ag e g ai n i s Af = %. f \n” ,Af ) // R e su l t17 X = R f / ( 1 + A ) ;
18 R i F = R 1 + ( X * R i ) / ( X + R i ) ; // I np ut r e s i s t a n c e w i t hf e e d b a c k
16
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
18/92
19 printf ( ” \n I np u t r e s i s t a n c e w i t h f ee db ac k i s RiF = %
. 1 f ohms \n” , R i F ) // R e su l t20 R o F = R o / ( 1 + A * B ) ; // Output r e s i s t a n c e w it h f e ed b ac k21 printf ( ” \n O utput r e s i s t a n c e w it h f e ed b ac k i s RoF =
%f ohms \n” , R o F ) // R e su l t22 f F = f o * ( 1 + A * B ) / K ; // B an dw id th w i th f e e d b a c k23 printf ( ” \n B an dwidth w it h f e e d ba c k i s vo = %. 2 f Hz \
n” , f F ) // R e su l t24 V o o T = V s a t / ( 1 + A * B ) ; // T ot a l o ut p u t o f f s e t v o l t a ge
w it h f e e d ba c k25 printf ( ” \n T o ta l o ut pu t o f f s e t v o l t a g e w i th f ee db ac k
i s VooT = % f V \n” , V o o T ) // R e su l t
Scilab code Exa 3.4 Output voltage of voltage shunt feedback amplifier
1 / / C h a pt e r32 // P age . No−8 6 , F i g u r e . No−3.83 / / E xa mp le 3 4
4 / / O utput v o l t a g e o f v o lt a g e −s hu nt f e e db a c ka m p l i f i e r
5 / / G iv en6 clear ; clc ;
7 R 1 = 4 7 0 ; R f = 4 . 7 * 1 0 ^ 3 ;
8 A = 2 0 0 0 0 0 ; // Open−l oo p v o l t ag e g ai n9 v i n = 1 ; // I np ut v o lt a g e i n v o l t s
10 K = R f / ( R 1 + R f ) ; // V ol ta ge a t t en u a ti o n f a c t o r11 B = R 1 / ( R 1 + R f ) ; // Gain o f t he f ee db ac k c i r c u i t12 A f = - ( A * K ) / ( 1 + A * B ) ; / / C l os e d−l oo p v o l t a g e g ai n
13 v o = A f * v i n ; / / Output v o l t a g e14 printf ( ” \n Output v o l t a g e i s vo = %. f V \n” , v o ) //R e s u l t
15 t = 0 : 0 . 1 : 2 * % p i ;
16 v o = - 1 0 * sin ( t ) ;
17
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
19/92
17 plot ( t , v o ) ;
18 t i t l e ( ’ O ut pu t V o l t a g e ’ ) ;19 x l a b e l ( ’ t ’ ) ;20 y l a b e l ( ’ Vo ’ ) ;
Scilab code Exa 3.5.a Gain input resistance of the amplifier
1 / / C h a pt e r32 // P age . No−9 6 , F i g u r e . No−3. 143 // E xa mp le 3 5 a4 // G ain I np ut r e s i s t a n c e o f t h e a m p l i f i e r5 / / G iv en6 clear ; clc ;
7 R 1 = 1 0 0 0 ; R 2 = 1 0 0 0 ;
8 R f = 1 0 * 1 0 ^ 3 ; R 3 = 1 0 * 1 0 ^ 3 ;
9 A D = - R f / R 1 ; // V o lt a ge g a in10 printf ( ” \n V o lt ag e g a in i s AD = %. f \n” , A D ) //
R e s u l t
11 R i F x = R 1 ; // 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 r12 printf ( ” \n I np 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 Ri Fx = % . f ohms \n” , R i F x ) // R e su l t13 R i F y = R 2 + R 3 ; // I np ut r e s i s t a n c e o f non−i n v e r t i n g
a m p l i f i e r14 printf ( ” \n I n p u t r e s i s t a n c e o f non− i n v e r t i n g
a m p l i f i e r i s RiFy = %. f ohms \n” , R i F y ) // R e su l t
Scilab code Exa 3.5.b Output voltage of an Opamp
1 / / C h a pt e r3
18
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
20/92
2 // P age . No−9 6 , F i g u r e . No−3. 14
3 // E xa mp le 3 5 b4 / / Output v o l t a g e o f an Op−amp5 / / G iv en6 clear ; clc ;
7 v x = 2 . 7 ; v y = 3 ; // Both i np ut v o l t a g e s a re i n v o l t s8 R f = 1 0 * 1 0 ^ 3 ; R 1 = 1 0 0 0 ; // Both a r e i n ohms9 A D = - R f / R 1 ; // V o lt a ge g a in
10 v x y = v x - v y ;
11 v o = A D * v x y ; / / Output v o l t a g e12 printf ( ” \n Output v o l t a g e i s vo = %. f V \n” , v o ) //
R e s u l t
Scilab code Exa 3.6.a Voltage gain and input resistance of the Opamp
1 / / C h a pt e r32 // P age . No−9 9 , F i g u r e . No−3. 163 // E xa mp le 3 6 a
4 // V ol ta ge g ai n and i np ut r e s i s t a n c e o f Op−amp5 / / G iv en6 clear ; clc ;
7 R 1 = 6 8 0 ; R 3 = 6 8 0 ; // Both a r e i n ohms8 R F = 6 8 0 0 ; R 2 = 6 8 0 0 ; // Both a r e i n ohms9 R i = 2 * 1 0 ^ 6 ; // Open−l oo p i np ut r e s i s t a n c e o f t h e op−
amp10 v x = - 1 . 5 ; v y = - 2 ; // Both a re i n v o l t s11 A = 2 0 0 0 0 0 ; // Open−l o o p Ga in12 A D = 1 + R F / R 1 ; // V ol t ag e g a in
13 printf ( ” \n V o lt ag e g a in i s AD = %. f \n” , A D ) //R e s u l t14 B = R 2 / ( R 2 + R 3 ) ;
15 R i F y = R i * ( 1 + A * B ) ; / / I np ut r e s i s t a n c e o f f i r s t s t a gea m p l i f i e r
19
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
21/92
16 printf ( ” \n I np 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” , R i F y ) // R e su l t17 B = R 1 / ( R 1 + R F ) ;18 R i F x = R i * ( 1 + A * B ) ; // I np ut r e s i s t a n c e o f s e co nd s t a g e
a m p l i f i e r19 printf ( ” \n I np u t r e s i s t a n c e o f s ec o nd s t a g e
a m p l i f i e r i s RiFx = %. 1 f ohms \n” , R i F x ) // R e su l t
Scilab code Exa 3.6.b Output voltage of the Opamp
1 / / C h a pt e r32 // P age . No−9 9 , F i g u r e . No−3. 163 // E xa mp le 3 6 b4 / / Output v o l t a g e o f t he Op−amp5 / / G iv en6 clear ; clc ;
7 R 1 = 6 8 0 ; R F = 6 8 0 0 // Both a r e i n ohms8 v x = - 1 . 5 ; v y = - 2 ; // Both i np ut v o l t a g e s a re i n v o l t s
9 A D = 1 + R F / R 1 ; // V ol t ag e g a in10 v x y = v x - v y ;
11 v o = A D * v x y ; / / Output v o l t a g e12 printf ( ” \n Output v o l t a g e i s vo = %. 1 f V \n” , v o ) //
R e s u l t
20
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
22/92
Chapter 4
The Practical Opamp
Scilab code Exa 4.1 Design of Compensating Network
1 / / C h a pt e r42 // P age . No−1143 / / E xa mp le 4 14 / / D e s ig n o f C om pe ns at in g N et wo rk5 / / G iv en6 clear ; clc ;
7 V = 1 0 // S up pl y v o l t a g e8 V i o = 1 0 * 1 0 ^ - 3 ; // I np ut o f f s e t v o l t a ge9 R c = 1 0 ; / / A s s um p t io n
10 R b = ( V / V i o ) * R c ;
11 printf ( ” \n R e s i s t a n ce Rb i s = %. f ohms \n” , R b ) //R e s u l t
12 R a = R b / 2 . 5 ; / / S i n ce Rb>Rmax , l e t u s c h o o s e Rb=1 0∗Rmaxwh er e Rmax=Ra/4
13 printf ( ” \n R e s i s t a n ce Ra i s = %. f ohms \n” , R a ) //R e s u l t
21
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
23/92
This code can be downloaded from the website wwww.scilab.in
Scilab code Exa 4.2 Max Output offset voltage
1 / / C h a pt e r42 // P age . No−1 21 , F i g u r e . No−4.133 / / E xa mp le 4 24 // Max O utput o f f s e t v o l t a g e5 / / G iv en6 clear ; clc ;
7 R 1 = 1 * 1 0 ^ 3 ; R f = 1 0 * 1 0 ^ 3 ;
8 V i o = 1 0 * 1 0 ^ - 3 ; // I np ut o f f s e t v o l t a ge9 A o o = 1 + R f / R 1 ; / / To f i n d max v a l u e o f Voo , we r e d uc e
i np ut v o l t a ge v in t o z er o .10 V o o = A o o * V i o ; // Max o ut p ut o f f s e t v o l t a g e11 printf ( ” \n Max o ut p ut o f f s e t v o l t a g e i s = %. 3 f V dc
\n” , V o o ) // R e su l t
Scilab code Exa 4.3 Design of input offset voltage compensating network
1 / / C h a pt e r42 // P age . No−1 21 , F i g u r e . No−4.14
3 / / E xa mp le 4 34 // D e s ig n o f i np ut o f f s e t v ol ta ge −c o m p e n s a t i n g
ne t w or k5 / / G iv en6 clear ; clc ;
22
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
24/92
7 R 1 = 1 * 1 0 ^ 3 ; R f = 1 0 * 1 0 ^ 3 ; R c = 1 0 ;
8 A f = 1 + R f / ( R 1 + R c ) ; // C lo se d l oo p g ai n o f non−i n v e r t i n g a m p l i f i e r9 printf ( ” \n C lo se d l oo p g ai n o f non− i n v e r t i n g
a m p l i f i e r i s = %. 1 f \n” , A f ) // R e su l t
This code can be downloaded from the website wwww.scilab.in
Scilab code Exa 4.4.a Max Output offset voltage
1 / / C h a pt e r42 // P age . No−1 27 , F i g u r e . No−4.193 // E xa mp le 4 4 a4 // Max O utput o f f s e t v o l t a g e5 / / G iv en6 clear ; clc ;
7 R 1 = 4 7 0 ; R f = 4 7 * 1 0 ^ 3 ;
8 V i o = 6 * 1 0 ^ - 3 ;9 I b = 5 0 0 * 1 0 ^ - 9 ;
10 V s = 1 5 ;
11 / / Max o ut p u t o f f s e t v o l t a ge due t o i np ut o f f s e tv o l ta g e , Vio i s :
12 V o o = ( 1 + R f / R 1 ) * V i o ; // Max o ut pu t o f f s e t v o l t ag e13 printf ( ” \n Max o ut p ut o f f s e t v o l t a g e i s = %. 3 f V dc
\n” , V o o ) // R e su l t14 / / Max o ut p u t o f f s e t v o l t a ge due t o i np ut o f f s e t
v o lt ag e , I b i s :15 V o I b = R f * I b ;
// Max o ut pu t o f f s e t v o l t ag e16 printf ( ” \n Max o ut p ut o f f s e t v o l t a g e due t o i np uto f f s e t c ur re nt , I b i s = %. 6 f V dc \n” , V o I b ) //R e s u l t
23
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
25/92
Scilab code Exa 4.4.b Effect of input bias current
1 / / C h a pt e r42 // P age . No−1 27 , F i g u r e . No−4.193 // E xa mp le 4 4 b4 // E f f e c t o f i np ut b i as c u r r e n t5 / / G iv en6 clear ; clc ;
7 R 1 = 4 7 0 ; R f = 4 7 * 1 0 ^ 3 ;
8 R O M = R 1 * R f / ( R 1 + R f ) ; // P a r a l l e l c om bi na ti on o f R1 andRf
9 printf ( ” \n P a r a l l e l c o m b in a t i o n o f R1 and Rf , i . e ROMi s = %. 1 f ohm \n” , R O M ) // A p p ro x im a t el y t h e
v a l ue i s 47 ohm
Scilab code Exa 4.5.a Max Output offset voltage
1 / / C h a pt e r42 // P age . No−1 27 , F i g u r e . No−4.193 // E xa mp le 4 5 a4 // Max O utput o f f s e t v o l t a g e5 / / G iv en6 clear ; clc ;
7 R 1 = 1 * 1 0 ^ 3 ; R f = 1 0 0 * 1 0 ^ 3 ;8 V i o = 6 * 1 0 ^ - 3 ;
9 I b = 5 0 0 * 1 0 ^ - 9 ;
10 V s = 1 5 ;
24
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
26/92
11 / / Max o ut p u t o f f s e t v o l t a ge due t o i np ut o f f s e t
v o l ta g e , Vio i s :12 V o o = ( 1 + R f / R 1 ) * V i o ; // Max o ut pu t o f f s e t v o l t ag e13 printf ( ” \n Max o ut p ut o f f s e t v o l t a g e due t o i np ut
o f f s e t v o l ta g e , Vio i s = %. 4 f V dc \n” , V o o ) //R e s u l t
14 / / Max o ut p u t o f f s e t v o l t a ge due t o i np ut o f f s e tv o lt ag e , I b i s :
15 V o I b = R f * I b ; // Max o ut pu t o f f s e t v o l t ag e16 printf ( ” \n Max o ut p ut o f f s e t v o l t a g e due t o i np ut
o f f s e t c ur re nt , I b i s = %. 4 f V dc \n” , V o I b ) //R e s u l t
Scilab code Exa 4.5.b Effect of input bias current
1 / / C h a pt e r42 // P age . No−1 27 , F i g u r e . No−4.193 // E xa mp le 4 4 b
4 // E f f e c t o f i np ut b i as c u r r e n t5 / / G iv en6 clear ; clc ;
7 R 1 = 1 * 1 0 ^ 3 ; R f = 1 0 0 * 1 0 ^ 3 ;
8 R O M = R 1 * R f / ( R 1 + R f ) ; // P a r a l l e l c om bi na ti on o f R1 andRf
9 printf ( ” \n P a r a l l e l c o m b in a t i o n o f R1 and Rf , i . e ROMi s = % . f ohm \n” , R O M )
Scilab code Exa 4.6 Max Output offset voltage
25
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
27/92
1 / / C h a pt e r4
2 // P age . No−1 30 , F i g u r e . No−4.213 / / E xa mp le 4 64 // Max O utput o f f s e t v o l t a g e5 / / G iv en6 clear ; clc ;
7 I i o = 2 0 0 * 1 0 ^ - 9 ; // I np u t o f f s e t c u r r en t8 R f = 1 0 0 * 1 0 ^ 3 ;
9 V o I i o = R f * I i o ; // Max o ut pu t o f f s e t v o l t a g e10 printf ( ” \n Max o ut p ut o f f s e t v o l t a g e due t o i np ut
o f f s e t c ur re nt , I b i s = %. 4 f V dc \n” , V o I i o ) //R e s u l t
Scilab code Exa 4.7 Total Output offset voltage
1 / / C h a pt e r42 // P age . No−1 32 , F i g u r e . No −4 . 2 2 ( a )3 / / E xa mp le 4 7
4 / / T ot al Output o f f s e t v o l t ag e5 / / G iv en6 clear ; clc ;
7 R 1 = 1 * 1 0 ^ 3 ; R f = 1 0 * 1 0 ^ 3 ;
8 V i o = 7 . 5 * 1 0 ^ - 3 ; // Max i n p ut o f f s e t v o l t ag e9 I i o = 5 0 * 1 0 ^ - 9 ; // Max i n p ut o f f s e t c u r r e nt
10 I b = 2 5 0 * 1 0 ^ - 9 ; // Max i n pu t b i a s c u r r e nt11 // For f i g u r e 4 . 2 2( a )12 V o o T = ( 1 + R f / R 1 ) * V i o + ( R f * I b ) ; // S i nc e t he c u r re n t
g en e r at ed o u t p ut o f f s e t v o l t a ge i s due t o i np ut
b i as c u r r e n t I b13 printf ( ” \n Max t o t a l o ut p u t o f f s e t v o l t a ge due t oi np ut o f f s e t c ur re nt , I b i s = %. 4 f V \n” , V o o T ) //
R e s u l t14
26
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
28/92
15 // F or f i g u r e 4 . 2 2( b )
16 V o o T = ( 1 + R f / R 1 ) * V i o + ( R f * I i o ) ; // S i nc e t he c u r r e ntg en e r at ed o u t p ut o f f s e t v o l t a ge i s due t o i np uto f f s e t c ur r e nt I b
17 printf ( ” \n Max t o t a l o ut p u t o f f s e t v o l t a ge due t oi np ut o f f s e t c ur re nt , I b i s = %. 4 f V \n” , V o o T ) //
R e s u l t
Scilab code Exa 4.8.a Error voltage and output voltage
1 / / C h a pt e r42 // P age . No−1 36 , F i g u r e . No−4.243 // E xa mp le 4 8 a4 / / E rr or v o l t a g e and o ut pu t v o l t ag e5 / / G iv en6 clear ; clc ;
7 d e l t a _ V i o = ( 3 0 * 1 0 ^ - 6 ) ; // Change i n i np ut o f f s e tv o l t a g e
8 d e l t a _ T = 1 ; // U ni t c ha ng e i n t e mp e ra t u re9 d e l t a _ I i o = ( 3 0 0 * 1 0 ^ - 1 2 ) ; // Change i n i np ut o f f s e t
c u r r e n t10 V s = 1 5 ;
11 R 1 = 1 * 1 0 ^ 3 ; R f = 1 0 0 * 1 0 ^ 3 ; R l = 1 0 * 1 0 ^ 3 ;
12 V i n = 1 * 1 0 ^ - 3 ; // I np ut v o l t a g e13 k = 2 5 ; // A mp l i f i e r i s n u l l e d a t 25 deg14 T = 3 5 - k ; // Chang e i n t e m p e r a tu r e15 E v = ( 1+ R f / R 1 ) * ( d e l t a_ V i o / d e l ta _ T ) * T + R f * ( d e l ta _ I io /
d e l t a _ T ) * T ; // E rr or v o l t ag e
16 printf ( ” \n E rr or v o l t a ge i s = %. 4 f V \n” , E v ) //R e s u l t17 V o = - ( R f / R 1 ) * V i n + E v ; / / Output v o l t a g e18 printf ( ” \n Output v o l t a g e i s = %. 4 f V \n” , V o ) //
R e s u l t
27
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
29/92
19 // (OR)
20 V o = - ( R f / R 1 ) * V i n - E v ; / / Output v o l t a g e21 printf ( ” \n Output v o l t a g e i s = %. 4 f V \n” , V o ) //R e s u l t
Scilab code Exa 4.8.b Error voltage and output voltage
1 / / C h a pt e r42 // P age . No−1 36 , F i g u r e . No−4.243 // E xa mp le 4 8 b4 / / E rr or v o l t a g e and o ut pu t v o l t ag e5 / / G iv en6 clear ; clc ;
7 d e l t a _ V i o = ( 3 0 * 1 0 ^ - 6 ) ; // Change i n i np ut o f f s e tv o l t a g e
8 d e l t a _ T = 1 ; // U ni t c ha ng e i n t e mp e ra t u re9 d e l t a _ I i o = ( 3 0 0 * 1 0 ^ - 1 2 ) ; // Change i n i np ut o f f s e t
c u r r e n t
10 V s = 1 5 ;11 R 1 = 1 * 1 0 ^ 3 ; R f = 1 0 0 * 1 0 ^ 3 ; R l = 1 0 * 1 0 ^ 3 ;
12 V i n = 1 0 * 1 0 ^ - 3 ; // I np ut v o l t ag e13 k = 2 5 ; // A mp l i f i e r i s n u l l e d a t 25 deg14 T = 3 5 - k ; // Chang e i n t e m p e r a tu r e15 E v = ( 1+ R f / R 1 ) * ( d e l t a_ V i o / d e l ta _ T ) * T + R f * ( d e l ta _ I io /
d e l t a _ T ) * T ; // E rr or v o l t ag e16 printf ( ” \n E rr or v o l t a ge i s = %. 4 f V \n” , E v ) //
R e s u l t17 V o = - ( R f / R 1 ) * V i n + E v ; / / Output v o l t a g e
18 printf ( ” \n Output v o l t a g e i s = %. 4 f V \n” , V o ) //R e s u l t19 // (OR)20 V o = - ( R f / R 1 ) * V i n - E v ; / / Output v o l t a g e21 printf ( ” \n Output v o l t a g e i s = %. 4 f V \n” , V o ) //
28
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
30/92
R e s u l t
Scilab code Exa 4.9.a Error voltage and output voltage
1 / / C h a pt e r42 // P age . No−1 36 , F i g u r e . No−4.243 // E xa mp le 4 9 a
4 / / E rr or v o l t a g e and o ut pu t v o l t ag e5 / / G iv en6 clear ; clc ;
7 d e l t a _ V i o = ( 3 0 * 1 0 ^ - 6 ) ; // Change i n i np ut o f f s e tv o l t a g e
8 d e l t a _ T = 1 ; // U ni t c ha ng e i n t e mp e ra t u re9 d e l t a _ I i o = ( 3 0 0 * 1 0 ^ - 1 2 ) ; // Change i n i np ut o f f s e t
c u r r e n t10 V s = 1 5 ;
11 R 1 = 1 * 1 0 ^ 3 ; R f = 1 0 0 * 1 0 ^ 3 ; R l = 1 0 * 1 0 ^ 3 ;
12 V i n = 1 0 * 1 0 ^ - 3 ; // I np ut v o l t ag e
13 k = 2 5 ; // A mp l i f i e r i s n u l l e d a t 25 deg14 T = 5 5 - k ; // Chang e i n t e m p e r a tu r e15 E v = ( 1+ R f / R 1 ) * ( d e l t a_ V i o / d e l ta _ T ) * T + R f * ( d e l ta _ I io /
d e l t a _ T ) * T ; // E rr or v o l t ag e16 printf ( ” \n E rr or v o l t a ge i s = %. 4 f V d c \n” , E v ) //
R e s u l t17 V o = - ( R f / R 1 ) * V i n + E v ; / / Output v o l t a g e18 printf ( ” \n Output v o l t a g e i s = %. 4 f V \n” , V o ) //
R e s u l t19 // (OR)
20 V o = - ( R f / R 1 ) * V i n - E v ; / / Output v o l t a g e21 printf ( ” \n Output v o l t a g e i s = %. 4 f V \n” , V o ) //R e s u l t
29
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
31/92
Scilab code Exa 4.9.b Output waveform
1 / / C h a pt e r42 // P age . No−1 36 , F i g u r e . No−4.243 // E xa mp le 4 9 b4 / / O ut pu t w a ve fo r m5 / / G iv en6 clear ; clc ;
7 t = 0 : 0. 1 : 2* % pi ;
8 y = - 10 00 * sin ( t ) + 9 1 . 8 ;
9 a = gca () ;
10 a . x _ l a b el . t e x t = ’ Time ’ ;11 a . y _ l a b el . t e x t = ’ V ol t ag e ’ ;12 a . t it le . t e xt = ’ O utput w av ef or m ’ ;13 plot2d ( t , y ) ;
14 t 1 = 0 : 0 . 1 : 2 * % p i ;
15 y 1 = 9 1 . 8 * ( t 1 > = 0 ) ;
16 b = gca () ;17 b . l i n e _ s t y l e = 3 ;
18 plot2d ( t 1 , y 1 ) ;
Scilab code Exa 4.10.a Error voltage and output voltage
1 / / C h a pt e r42 // P age . No−1 41 , F i g u r e . No−4.26
3 // E xa mp le 4 1 0 a4 / / E rr or v o l t a g e and o ut pu t v o l t ag e5 / / G iv en6 clear ; clc ;
30
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
32/92
7 d e l t a _ V i o = ( 3 0 * 1 0 ^ - 6 ) ; // Change i n i np ut o f f s e t
v o l t a g e8 d e l t a _ T = 1 ; // U ni t c ha ng e i n t e mp e ra t u re9 d e l t a _ I i o = ( 3 0 0 * 1 0 ^ - 1 2 ) ; // Change i n i np ut o f f s e t
c u r r e n t10 V s = 1 5 ;
11 R 1 = 1 * 1 0 ^ 3 ; R f = 1 0 0 * 1 0 ^ 3 ;
12 V i n = 1 * 1 0 ^ - 3 ; // I np ut v o l t a g e13 k = 2 5 ; // A mp l i f i e r i s n u l l e d a t 25 deg14 T = 3 5 - k ; // Chang e i n t e m p e r a tu r e15 E v = ( 1+ R f / R 1 ) * ( d e l t a_ V i o / d e l ta _ T ) * T + R f * ( d e l ta _ I io /
d e l t a _ T ) * T ; // E rr or v o l t ag e
16 printf ( ” \n E rr or v o l t a ge i s = %. 4 f V d c \n” , E v ) //R e s u l t
17 V o = ( 1 + R f / R 1 ) * V i n + E v ; / / Output v o l t a g e18 printf ( ” \n Output v o l t a g e i s = %. 4 f V \n” , V o ) //
R e s u l t19 // (OR)20 V o = ( 1 + R f / R 1 ) * V i n - E v ; / / Output v o l t a g e21 printf ( ” \n Output v o l t a g e i s = %. 4 f V \n” , V o ) //
R e s u l t
Scilab code Exa 4.10.b Error voltage and output voltage
1 / / C h a pt e r42 // P age . No−1 41 , F i g u r e . No−4.263 // E xa mp le 4 1 0 b4 / / E rr or v o l t a g e and o ut pu t v o l t ag e
5 / / G iv en6 clear ; clc ;7 d e l t a _ V i o = ( 3 0 * 1 0 ^ - 6 ) ; // Change i n i np ut o f f s e t
v o l t a g e8 d e l t a _ T = 1 ; // U ni t c ha ng e i n t e mp e ra t u re
31
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
33/92
9 d e l t a _ I i o = ( 3 0 0 * 1 0 ^ - 1 2 ) ; // Change i n i np ut o f f s e t
c u r r e n t10 V s = 1 5 ;11 R 1 = 1 * 1 0 ^ 3 ; R f = 1 0 0 * 1 0 ^ 3 ; R l = 1 0 * 1 0 ^ 3 ;
12 V i n = 1 0 * 1 0 ^ - 3 ; // I np ut v o l t ag e13 k = 2 5 ; // A mp l i f i e r i s n u l l e d a t 25 deg14 T = 3 5 - k ; // Chang e i n t e m p e r a tu r e15 E v = ( 1+ R f / R 1 ) * ( d e l t a_ V i o / d e l ta _ T ) * T + R f * ( d e l ta _ I io /
d e l t a _ T ) * T ; // E rr or v o l t ag e16 printf ( ” \n E rr or v o l t a ge i s = %. 4 f V d c \n” , E v ) //
R e s u l t17 V o = ( 1 + R f / R 1 ) * V i n + E v ; / / Output v o l t a g e
18 printf ( ” \n Output v o l t a g e i s = %. 4 f V d c \n” , V o ) //R e s u l t
19 // (OR)20 V o = ( 1 + R f / R 1 ) * V i n - E v ; / / Output v o l t a g e21 printf ( ” \n Output v o l t a g e i s = %. 4 f V d c \n” , V o ) //
R e s u l t
Scilab code Exa 4.11.a Output offset voltage
1 / / C h a pt e r42 // P age . No−1 41 , F i g u r e . No−4.283 // E xa mp le 4 1 1 a4 // Output o f f s e t v o l t a g e5 / / G iv en6 clear ; clc ;
7 d e l t a _ V i o = 1 5 . 8 5 * 1 0 ^ - 6 ; // Change i n i np ut o f f s e t
v o l t a g e8 d e l t a _ V = 1 ; // U ni t c ha ng e i n s up pl y v o l t a g e9 V = 2 ; // Change i n s up p ly v o l t a g e
10 R 1 = 1 * 1 0 ^ 3 ; R f = 1 0 0 * 1 0 ^ 3 ;
11 d e l t a _ V o o = ( 1 + R f / R 1 ) * ( d e l t a _ V i o / d e l t a _ V ) * V ; // C hange
32
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
34/92
i n o u t p u t o f f s e t v o l t a ge
12 printf ( ” \n Change i n o ut pu t o f f s e t v o l t a g e i s = %. 4 f V \n” , d e l t a _ V o o ) // R e su l t
Scilab code Exa 4.11.b Output offset voltage
1 / / C h a pt e r4
2 // P age . No−1 41 , F i g u r e . No−4.283 // E xa mp le 4 1 1 b4 // Output o f f s e t v o l t a g e5 / / G iv en6 clear ; clc ;
7 d e l t a _ V i o = 1 5 . 8 5 * 1 0 ^ - 6 ; // Change i n i np ut o f f s e tv o l t a g e
8 d e l t a _ V = 1 ; // U ni t c ha ng e i n s up pl y v o l t a g e9 V = 2 ; // Change i n s up p ly v o l t a g e
10 V i n = 1 0 * 1 0 ^ - 3 ;
11 R 1 = 1 * 1 0 ^ 3 ; R f = 1 0 0 * 1 0 ^ 3 ;
12 d e l t a _ V o o = ( 1 + R f / R 1 ) * ( d e l t a _ V i o / d e l t a _ V ) * V ; / / O ut pu to f f s e t v o l t a g e
13 V o = ( - R f / R 1 ) * V i n + d e l t a _ V o o ; // T ot al o ut pu t o f f s e tv o l t a g e
14 printf ( ” \n T o ta l o u t p ut o f f s e t v o l t a ge i s = %. 4 f V \n” , V o ) // R e su l t
15 // (OR)16 V o = ( - R f / R 1 ) * V i n - d e l t a _ V o o ; // T ot al o ut pu t o f f s e t
v o l t a g e17 printf ( ” \n T o ta l o u t p ut o f f s e t v o l t a ge i s = %. 4 f V \
n” , V o ) // R e su l t
33
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
35/92
Scilab code Exa 4.12 Output ripple voltage
1 / / C h a pt e r42 // P age . No−1 41 , F i g u r e . No −4 . 2 8 ( b )3 / / E xa m pl e 4 124 // Output r i p p l e v o l t a g e5 / / G iv en6 clear ; clc ;
7 d e l t a _ V i o = 1 5 . 8 5 * 1 0 ^ - 6 ; // Change i n i np ut o f f s e tv o l t a g e
8 d e l t a _ V = 1 ; // U ni t c ha ng e i n s up pl y v o l t a g e9 V = 1 0 * 1 0 ^ - 3 ; // Change i n s up p ly v o l t a g e
10 R 1 = 1 * 1 0 ^ 3 ; R f = 1 0 0 * 1 0 ^ 3 ;
11 d e l t a _ V o o = ( 1 + R f / R 1 ) * ( d e l t a _ V i o / d e l t a _ V ) * V ; // C hangei n o u t p u t o f f s e t v o l t a ge
12 printf ( ” \n Change i n o ut pu t o f f s e t v o l t a g e i s = %. 6 f V \n” , d e l t a _ V o o ) // R e su l t
Scilab code Exa 4.13 Change in output offset voltage
1 / / C h a pt e r42 // P age . No−1 36 , F i g u r e . No−4.243 / / E xa m pl e 4 13
4 / / Change i n o ut pu t o f f s e t v o l t a g e5 / / G iv en6 clear ; clc ;
7 d e l t a _ V i o = 5 * 1 0 ^ - 6 ; // Change i n i np ut o f f s e t v o l t ag e8 d e l t a _ t = 1 ; // U ni t c ha ng e i n t im e
34
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
36/92
9 d e l t a _ I i o = 2 * 1 0 ^ - 9 ; // Change i n i np ut o f f s e t c u r r e nt
10 t = 4 ; / / Ti me e l a p s e d ( w e e ks )11 R 1 = 1 * 1 0 ^ 3 ; R f = 1 0 0 * 1 0 ^ 3 ; R l = 1 0 * 1 0 ^ 3 ;12 d e l t a _ V o o t = ( 1 + R f / R 1 ) * ( d e l t a _ V i o / d e l t a _ t ) * t + R f * (
d e l t a _ I i o / d e l t a _ t ) * t ; // Change i n o ut pu t o f f s e tv o l t a g e
13 printf ( ” \n Change i n o ut pu t o f f s e t v o l t a g e i s = %. 4 f V \n” , d e l t a _ V o o t ) // R e su l t
Scilab code Exa 4.14.a Output voltage
1 / / C h a pt e r42 // P age . No−1 53 , F i g u r e . No−4.323 // E xa mp le 4 1 4 a4 / / Output v o l t a g e5 / / G iv en6 clear ; clc ;
7 R 1 = 1 * 1 0 ^ 3 ; R 2 = 1 * 1 0 ^ 3 ; R f = 1 0 * 1 0 ^ 3 ; R 3 = 1 0 * 1 0 ^ 3 ;
8 v d = 5 * 1 0 ^ - 3 ; // D i f f e r e n t i a l v o l t a g e9 v c m = 2 * 1 0 ^ - 3 ; / / Common−mode v o l t a g e
10 A d = R f / R 1 ; / / C l os e d−lo op d i f f e r e n t i a l ga in11 v o = A d * v d ; / / Output v o l t a g e12 printf ( ” \n Output v o l t a g e i s = %. 3 f V \n” , v o ) //
R e s u l t
Scilab code Exa 4.14.b Output common mode voltage
1 / / C h a pt e r42 // P age . No−1 53 , F i g u r e . No−4.32
35
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
37/92
3 // E xa mp le 4 1 4 b
4 // Output common−mode v o l t a g e5 / / G iv en6 clear ; clc ;
7 R 1 = 1 * 1 0 ^ 3 ; R 2 = 1 * 1 0 ^ 3 ; R f = 1 0 * 1 0 ^ 3 ; R 3 = 1 0 * 1 0 ^ 3 ;
8 v d = 5 * 1 0 ^ - 3 ; // D i f f e r e n t i a l v o l t a g e9 v c m = 2 * 1 0 ^ - 3 ; / / Common−mode v o l t a g e
10 A d = R f / R 1 ; / / C l os e d−lo op d i f f e r e n t i a l ga in11 C M R R d b = 9 0
12 C M R R = 1 0 ^ ( 9 0 / 2 0 ) ; // Us in g CMRRdb=20∗ l o g 1 0 (CMRR) , toc 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 tn u m e ri c a l v a l u e
13 printf ( ” \n CMRR i s = %.2 f \n” , C M R R ) // R e su l t14 v o c m = ( A d * v c m ) / C M R R ; // Output common−mode v o l t a g e15 printf ( ” \n Output common−mode v o l t a g e i s = %. 8 f V \n
” , v o c m ) // R e su l t
36
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
38/92
Chapter 5
Frequency Response of an
Opamp
Scilab code Exa 5.1 Maximum gain
1 / / C ha p t er 52 // P age . No−1 71 , F i g u r e . No−5.43 / / E xa mp le 5 14 / / Maximum ga in5 / / G iv en6 clear ; clc ;
7 f o = 5 ; // Break f r e q o f t h e op−amp i n Hz8 s = % s ;
9 A = 2 0 0 0 0 0 ; // Gain o f t he op−amp a t 0 Hz10 H = syslin ( ’ c ’ , ( A * f o * 2 * % p i ) / ( ( f o * 2 * % p i ) + s ) ) ;11 f m i n = 1 ;
12 f m a x = 1 0 0 0 0 0 ;
13 bode ( H , f m i n , f m a x ) ;
14 A o l = 4 0 ;
15 printf ( ” \n Maximum g a i n i s = % . f dB \n ” , A o l ) ; //From t h e g r a ph
37
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
39/92
Scilab code Exa 5.2 Gain equation and break frequencies
1 / / C h a p t e r 52 // Page . No−1 72 , F i g u r e . No−5.53 / / E x a m p l e 5 24 / / Gain e q ua t i on and b re ak f r e q u e n c i e s5 // Given :6 clear ; clc ;
7 p h a s e = - 1 5 7 . 5 ; // Phas e s h i f t a t a bo ut 3 MHz8 f = 3 * 1 0 ^ 6 ;
9 disp ( ” G a in e q u a t i o n i s A o l ( f )=A / ( ( 1 + ( f / f o 1 ) ∗ j ) ∗(1+( f / fo 2 ) ∗ j ) ) , where fo1 − f i r s t b r e ak f r e q u e n c y and f o 2−s e co n d b r ea k f r e q u e n cy ” ) // From t he f i g u r e
10 f o 1 = 6 ;
11 printf ( ” \n F i r s t b r ea k f r e qu e n c y f o1 i s = %. f Hz \n”, f o 1 ) / / F rom t h e g r a ph
12 k = - a t a n d ( f / f o 1 ) - p h a s e ;
13 f o 2 = f / t a n d ( k ) ;14 printf ( ” \n S eco nd b re ak f r eq u e nc y f o 2 i s = %. 1 f Hz \
n” , f o 2 ) // R e su l t
Scilab code Exa 5.3 Stability of voltage follower
1 / / C ha p t er 52 // P age . No−8 3 , F i g u r e . No−3.73 / / E xa mp le 5 34 // 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 r5 / / G iv en
38
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
40/92
6 clear ; clc ;
7 f o = 5 ; // Break f r e q o f t h e op−amp i n Hz8 s = % s ;9 A = 2 0 0 0 0 0 ; // Gain o f t he op−amp a t 0 Hz
10 H = syslin ( ’ c ’ , ( A * f o * 2 * % p i ) / ( ( f o * 2 * % p i ) + s ) ) ;11 f m i n = 1 0 ;
12 f m a x = 1 0 0 0 0 0 0 ;
13 bode ( H , f m i n , f m a x ) ;
14 A o l = 0 ;
15 printf ( ” \n M agni tude a t whi ch v o l t a g e f o l l o w e r i ss t a b l e i s = %. f dB \n ” , A o l ) ; // From t h e g r a ph
39
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
41/92
Chapter 6
General Linear Applications
Scilab code Exa 6.1 Bandwidth of the amplifier
1 / / C h a pt e r62 // P age . No−1 93 , F i g u r e . No − 6 . 3 ( a )3 / / E xa mp le 6 14 / / B andwidth o f t he a m p l i f i e r5 / / G iv en6 clear ; clc ;
7 R 1 = 1 0 0 ; R f = 1 * 1 0 ^ 3 ; R i n = 5 0 ; R l = 1 0 * 1 0 ^ 3 ;8 C i = 0 . 1 * 1 0 ^ - 6 ; // C ap a ci t an ce b /w 2 s t a g e s b e in g
c o u p l e d9 R i F = R 1 ; // ac i np ut r e s i s t a n c e o f t h e s ec o nd s t a g e
10 R o = R i n ; // ac o ut p u t r e s i s t a n c e o f t he 1 s t s t a g e11 U G B = 1 0 ^ 6 ; // U ni t y g a i n b an dw id th12 f l = 1 / ( 2 * % p i * C i * ( R i F + R o ) ) ; // Low−f r e q c u t o f f 13 printf ( ” \n Low−f r e q c u t o f f i s = %. 1 f Hz \n” , f l ) //
R e s u l t14 K = R f / ( R 1 + R f ) ;
15 A f = - R f / R 1 ; // c l o se d l oo p v o l t a ge g ai n16 f h = U G B * K / abs ( A f ) ; / / H ig h−f r e q c u t o f f 17 printf ( ” \n H ig h−f r e q c u t o f f i s = %. 1 f Hz \n” , f h ) //
R e s u l t18 B W = f h - f l ; // Bandw i dt h
40
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
42/92
19 printf ( ” \n B an dw id th i s = %. 1 f Hz \n” , B W ) // R e su l t
Scilab code Exa 6.2.a Bandwidth of the amplifier
1 / / C h a pt e r62 // P age . No−1 93 , F i g u r e . No − 6. 4( c )3 // E xa mp le 6 2 a
4 / / B andwidth o f t he a m p l i f i e r5 / / G iv en6 clear ; clc ;
7 R 1 = 1 0 0 * 1 0 ^ 3 ; R 2 = 1 0 0 * 1 0 ^ 3 ; R 3 = 1 0 0 * 1 0 ^ 3 ; R f = 1 * 1 0 ^ 6 ; R i n
=50;
8 C i = 0 . 1 * 1 0 ^ - 6 ; // C ap a ci t an ce b /w 2 s t a g e s b e in gc o u p l e d
9 R o = R i n ; // ac o ut p u t r e s i s t a n c e o f t he 1 s t s t a g e10 V c c = 1 5 ;
11 U G B = 1 0 ^ 6 ; // U ni t y g a i n b an dw id th12 R i f = R 2 * R 3 / ( R 2 + R 3 ) ; // s i n c e R i ∗(1+A∗B)>>R2 o r R3
13 f l = 1 / ( 2 * % p i * C i * ( R i f + R o ) ) ; / / l ow−f r e q c u t o f f 14 printf ( ” \n Low−f r e q c u t o f f i s = %. 1 f Hz \n” , f l ) //
R e s u l t15 K = R f / ( R 1 + R f ) ;
16 A f = - R f / R 1 ; // c l o se d l oo p v o l t a ge g ai n17 f h = U G B * K / abs ( A f ) ; / / H ig h−f r e q c u t o f f 18 printf ( ” \n H ig h−f r e q c u t o f f i s = %. 1 f Hz \n” , f h ) //
R e s u l t19 B W = f h - f l ; // Bandw i dt h20 printf ( ” \n B an dw id th i s = %. 1 f Hz \n” , B W ) // R e su l t
41
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
43/92
Scilab code Exa 6.2.b Max output voltage swing
1 / / C h a pt e r62 // P age . No−1 93 , F i g u r e . No − 6. 4( c )3 // E xa mp le 6 2 b4 / / Max o ut pu t v o l t a g e s wi ng5 / / G iv en6 clear ; clc ;
7 R 1 = 1 0 0 * 1 0 ^ 3 ; R 2 = 1 0 0 * 1 0 ^ 3 ; R 3 = 1 0 0 * 1 0 ^ 3 ; R f = 1 * 1 0 ^ 6 ; R i n
=50;
8 C i = 0 . 1 * 1 0 ^ - 6 ; // C ap a ci t an ce b /w 2 s t a g e s b e in gc o u p l e d
9 R o = R i n ; // ac o ut p u t r e s i s t a n c e o f t he 1 s t s t a g e10 U G B = 1 0 ^ 6 ; // U ni t y g a i n b an dw id th11 V c c = 1 5 ;
12 printf ( ” \n The i d e a l maximum o u tp u t v o l t a g e s wi ng i s= %. f V pp \n” , V c c )
Scilab code Exa 6.3 Components of peak amplifier
1 / / C h a pt e r62 // P age . No−1 93 , F i g u r e . No − 6 . 5 ( a )3 / / E xa mp le 6 34 / / C omponents o f p ea k a m p l i f i e r5 / / G iv en6 clear ; clc ;
7 f p = 1 6 * 1 0 ^ 3 ; / / Peak f r e q u e n c y8 A f = 1 0 ; // Gain a t p eak f r e qu e n cy
9 C = 0 . 0 1 * 1 0 ^ - 6 ; // Assume10 L = 1 / ( ( ( 2 * % p i * f p ) ^ 2 ) * 1 0 ^ - 8 ) ; / / S i m p l i f y i n g f p =1/ (2∗p i ∗ s q r t ( L∗C) )
11 printf ( ” \n I n du c ta n ce i s = %. 4 f H \n” ,L )12 L = 1 0 * 1 0 ^ - 3 ; / / A p p ro x i m at e
42
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
44/92
13 R = 3 0 ; // A ssume t h e v al ue o f i n t e r n a l r e s i s t a n c e o f
t he i n d u c to r14 X l = 2 * % p i * f p * L ; // I n d uc t i v e r e a ct a n ce15 Q c o i l = X l / R ; // F ig ur e o f m er i t o f t h e c o i l16 printf ( ” \n F i gu re o f m e r it o f t h e c o i l i s = %. 1 f \n”
, Q c o i l )
17 R p = ( Q c o i l ) ^ 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 an kc i r c u i t
18 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 nk c i r c u i ti s = %. 1 f ohm \n” , R p )
19 R 1 = 1 0 0 ; // Assume t h e v al ue o f i n t e r n a l r e s i s r a n c eo f t h e c o i l
20 R f = - R p / ( 1 - ( R p / ( A f * R 1 ) ) ) ; // S i m p l i f y i n g Af =( Rf | | Rp) /R1
21 printf ( ” \n Feed ba ck r e s i s t a n c e i s = %. 1 f ohm \n” , R f )
Scilab code Exa 6.4 Output voltage
1 / / C h a pt e r62 // P age . No−2 00 , F i g u r e . No−6.63 / / E xa mp le 6 44 / / Output v o l t a g e5 / / G iv en6 clear ; clc ;
7 V a = 1 ; V b = 2 ; V c = 3 ; // I n pu t v o l t a g e s i n v o l t s8 R a = 3 * 1 0 ^ 3 ; R b = 3 * 1 0 ^ 3 ; R c = 3 * 1 0 ^ 3 ; R f = 1 * 1 0 ^ 3 ;
9 V o = - ( ( R f / R a ) * V a + ( R f / R b ) * V b + ( R f / R c ) * V c ) ; // O utputv o l t a g e
10 printf ( ” \n Output v o l t a g e i s = %. f V \n” , V o )
43
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
45/92
Scilab code Exa 6.5 Output voltage
1 / / C h a pt e r62 // P age . No−2 03 , F i g u r e . No−6.73 / / E xa mp le 6 54 / / Output v o l t a g e5 / / G iv en6 clear ; clc ;
7 V a = 2 ; V b = - 3 ; V c = 4 ; // I np ut v o l t a g e s i n v o l t s8 R 1 = 1 * 1 0 ^ 3 ; R f = 2 * 1 0 ^ 3 ;
9 V 1 = ( V a + V b + V c ) / 3 ; // V ol t ag e a t non− i n v e r t i n gt e r m i n a l
10 printf ( ” \n V o lt ag e a t non− i n v e r t i n g t e r m i n al i s = %.f V \n” , V 1 )
11 V o = ( 1 + R f / R 1 ) * V 1 ; // Output v o l t a g e12 printf ( ” \n Output v o l t a g e i s = %. f V \n” , V o )
Scilab code Exa 6.6 Output voltage
1 / / C h a pt e r62 // P age . No−2 05 , F i g u r e . No−6.93 / / E xa mp le 6 64 / / Output v o l t a g e
5 / / G iv en6 clear ; clc ;
7 V a = 2 ; V b = 3 ; V c = 4 ; V d = 5 ; // I n pu t v o l t a g e s i n v o l t s8 R = 1 * 1 0 ^ 3 ;
9 V o = - V a - V b + V c + V d ; // Output v o l t a g e
44
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
46/92
10 printf ( ” \n Output v o l t a g e i s = %. f V \n” , V o )
Scilab code Exa 6.7 Output voltage
1 / / C h a pt e r62 // P age . No−2 09 , F i g u r e . No−6.123 / / E xa mp le 6 7
4 / / Output v o l t a g e5 / / G iv en6 clear ; clc ;
7 R 1 = 1 * 1 0 ^ 3 ; R f = 4 . 7 * 1 0 ^ 3 ; R a = 1 0 0 * 1 0 ^ 3 ; R b = 1 0 0 * 1 0 ^ 3 ; R c
= 1 0 0 * 1 0 ^ 3 ;
8 V d c = 5 ;
9 R t = 1 0 0 * 1 0 ^ 3 ; // R e s i st a nc e o f a t h er m is t or10 t e m p _ c o e f f = 1 * 1 0 ^ 3 ;
11
12 / / O utput v o l t a g e a t 0 d e g re e13 d e l t a _ R = - t e m p _ c o e f f * ( 0 - 2 5 ) ; // Change i n r e s i s t a n c e
14 R = R a ; // Ra=Rb=Rc=R15 V o = ( ( R f * d e l t a _ R ) / ( R 1 * 4 * R ) ) * V d c ;
16 printf ( ” \n Output v o l t ag e a t 0 d e g r ee i s = %. 2 f V \n” , V o )
17
18 / / Output v o l t a g e a t 1 00 d e gr e e19 d e l t a _ R = - t e m p _ c o e f f * ( 1 0 0 - 2 5 ) ; / / C ha ng e i n
r e s i s t a n c e20 V o = ( ( R f * d e l t a _ R ) / ( R 1 * 4 * R ) ) * V d c ;
21 printf ( ” \n Output v o l t ag e a t 100 d e g r ee i s = %. 2 f V
\n” , V o )
45
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
47/92
Scilab code Exa 6.8 Change in resistance in straingage
1 / / C h a pt e r62 // P age . No−2 09 , F i g u r e . No−6.123 / / E xa mp le 6 74 / / Change i n r e s i s t a n c e i n s t r ai n g a ge5 / / G iv en6 clear ; clc ;
7 A = - 1 0 0 ; / / G ai n o f t h e d i f f e r e n t i a l i n s t r u m e n t a t i o na m p l i f i e r
8 R a = 1 0 0 ; R b = 1 0 0 ; R c = 1 0 0 ;
9 V d c = 1 0 ; V o = 1 ;
10 R = R a ; // Ra=Rb=Rc=R11 d e l t a _ R = ( V o * R ) / ( V d c * abs ( A ) ) ; // Change i n r e s i s t a n c e12 printf ( ” \n Change i n r e s i s t a n c e i s = %. 1 f ohm \n” ,
d e l t a _ R )
Scilab code Exa 6.9 Gain of the amplifier
1 / / C h a pt e r62 // P age . No−2 16 , F i g u r e . No −6 . 1 4 ( a )3 / / E xa mp le 6 94 / / Gain o f t h e a m p l i f i e r
5 / / G iv en6 clear ; clc ;
7 V o = 3 . 7 ; V i n = 1 0 0 * 1 0 ^ - 3 ;
8 R 1 = 1 0 0 ; // Assume9 R f = 0 . 5 * ( ( V o * R 1 ) / V i n - 1 ) ; // Fee db ack r e s i s r a n c e
46
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
48/92
10 printf ( ” \n Feed ba ck r e s i s r a n c e i s = %. 1 f ohm \n” , R f )
11 A = ( 1 + 2 * R f / R 1 ) ; / / G ai n o f t h e d i f f e r e n t i a l a m p l i f i e r12 printf ( ” \n G ai n o f t h e 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” ,A )
Scilab code Exa 6.10 Range of input voltage
1 / / C h a pt e r62 // P age . No−2 20 , F i g u r e . No−6.173 / / E xa m pl e 6 104 / / Range o f i n pu t v o l t a g e5 / / G iv en6 clear ; clc ;
7 R 1 m i n = 1 * 1 0 ^ 3 ; R 1 m a x = 6 . 8 * 1 0 ^ 3 ;
8 i o = 1 * 1 0 ^ - 3 ; // Meter c u rr e n t f o r f u l l −waver e c t i f i c a t i o n
9 v i n _ m i n = 1 . 1 * R 1 m i n * i o ; // Minimum i n p u t v o l t a g e10 printf ( ” \n Minimum i n p u t v o l t a g e i s = %. 1 f V \n” ,
v i n _ m i n )11 v i n _ m a x = 1 . 1 * R 1 m a x * i o ; / / Maximum i n p u t v o l t a g e12 printf ( ” \n Maximum i n p u t v o l t a g e i s = %. 2 f V \n” ,
v i n _ m a x )
Scilab code Exa 6.11 Current and voltage drop
1 / / C h a pt e r62 // P age . No−2 22 , F i g u r e . No−6.183 / / E xa m pl e 6 114 / / C ur re nt and v o l t a g e d ro p
47
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
49/92
5 / / G iv en
6 clear ; clc ;7 V i n = 0 . 5 ; V o = 1 . 2 ;
8 R 1 = 1 0 0 ;
9 I o = V i n / R 1 ; // C ur re nt t hr o ug h d i o d e10 printf ( ” \n C ur re nt t hr ou gh d i od e i s = %. 4 f A \n” , I o )11 V d = V o - V i n ; // V ol ta ge dr op a c r o s s d io de12 printf ( ” \n V ol ta ge dr op a c r o s s d io de i s = %. 1 f V \n”
, V d )
Scilab code Exa 6.12.a Load current
1 / / C h a pt e r62 // P age . No−2 22 , F i g u r e . No−6.193 // E xa mp le 6 1 2 a4 / / Load c u r r e n t5 / / G iv en6 clear ; clc ;
7 V i n = 5 ; V 1 = 1 ;8 R = 1 0 * 1 0 ^ 3 ;
9 I l = V i n / R ; // Load c u r r e n t10 printf ( ” \n Load c u r re n t i s = %. 5 f A \n” , I l )
Scilab code Exa 6.12.b Output voltage
1 / / C h a pt e r62 // P age . No−2 22 , F i g u r e . No−6.193 // E xa mp le 6 1 2 b4 / / Output v o l t a g e
48
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
50/92
5 / / G iv en
6 clear ; clc ;7 V i n = 5 ; V 1 = 1 ;
8 R = 1 0 * 1 0 ^ 3 ;
9 V o = 2 * V 1 ; // Output v o l t a g e10 printf ( ” \n Output v o l t a g e i s = %. f V \n” , V o )
Scilab code Exa 6.13 Range of output voltage
1 / / C h a pt e r62 // P age . No−2 22 , F i g u r e . No−6.203 / / E xa m pl e 6 134 / / Range o f o ut pu t v o l t a g e5 / / G iv en6 clear ; clc ;
7 R 1 = 1 * 1 0 ^ 3 ; R f = 2 . 7 * 1 0 ^ 3 ;
8 V r e f = 2 ;
9 I o = 0 ; // S i n ce a l l t h e b in ar y i np u t s D0 t o D7 a r e
l o g i c z er o10 V o _ m i n = I o * R f ; / / Minimum o u t p u t v o l t a g e11 printf ( ” \n Minimum o u t pu t v o l t a g e i s = % . f V \n” ,
V o _ m i n )
12 I o = ( V r e f / R 1 )
* ( 1 / 2 + 1 / 4 + 1 / 8 + 1 / 1 6 + 1 / 3 2 + 1 / 6 4 + 1 / 1 2 8 + 1 / 2 5 6 ) ;
13 V o _ m a x = I o * R f ; / / Maximum o u t p u t v o l t a g e14 printf ( ” \n Maximum o u t pu t v o l t a g e i s = %. 2 f V \n” ,
V o _ m a x )
Scilab code Exa 6.14 Change in output voltage
49
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
51/92
1 / / C h a pt e r6
2 // P age . No−2 28 , F i g u r e . No−6.213 / / E xa m pl e 6 144 / / C hange i n o u tp ut v o l t a g e5 / / G iv en6 clear ; clc ;
7 R f = 3 * 1 0 ^ 3 ;
8 V d c = 5 ;
9 R t = 1 0 0 * 1 0 ^ 3 ; // R e s is t a nc e a t d a rk ne ss10 V o m i n = - ( V d c / R t ) * R f ; // Min o ut pu t v o l t a g e a t
d a r k n e s s11 printf ( ” \n Min o ut p ut v o l t a g e a t d a rk ne ss i s = %. 2 f
V \n” , V o m i n )12 R t = 1 . 5 * 1 0 ^ 3 ; // R e s i st a nc e a t I l l u mi n a t i o n13 V o m a x = - ( V d c / R t ) * R f ; // Max o ut p ut v o l t a g e a t
I l l u m i n a t i o n14 printf ( ” \n Max o u tp ut 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” , V o m a x )
Scilab code Exa 6.15 Output voltage of an integrator
1 / / C h a pt e r62 // P age . No−2 30 , F i g u r e . No−6.233 / / E xa m pl e 6 154 / / O utput v o l t a g e o f an i n t e g r a t o r5 / / G iv en6 clear ; clc ;
7 V i n = 2 ; // I np ut v o lt a g e i n v o l t
8 V o 0 = 0 ;9 V o 1 = - i n t e g r a t e ( ’ 2 ’ , ’ t ’ ,0,1);10 disp ( V o 1 )
11 V o 2 = - i n t e g r a t e ( ’ 2 ’ , ’ t ’ , 1 , 2 ) + V o 1 ;12 disp ( V o 2 )
50
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
52/92
13 V o 3 = - i n t e g r a t e ( ’ 2 ’ , ’ t ’ , 2 , 3 ) + V o 2 ;
14 disp ( V o 3 )15 V o 4 = - i n t e g r a t e ( ’ 2 ’ , ’ t ’ , 3 , 4 ) + V o 3 ;16 disp ( V o 4 )
17 V o = [ Vo 0 V o1 V o2 V o3 V o4 ] ;
18 t = [0 1 2 3 4];
19 plot ( t , V o ) ;
20 t i t l e ( ’ O ut pu t V o l t a g e ’ ) ;21 x l a b e l ( ’ t ’ ) ;22 y l a b e l ( ’ Vo ’ ) ;
Scilab code Exa 6.16.a Design of differentiator
1 / / C h a pt e r62 // P age . No−2383 // E xa mp le 6 1 6 a4 // D e s i g n o f d i f f e r e n t i a t o r5 / / G iv en6 clear ; clc ;
7 C 1 = 0 . 1 * 1 0 ^ - 6 ; // Assume
8 f a = 1 * 1 0 ^ 3 ; // Freq a t whi ch g ai n i s 0 dB9 R f = 1 / ( 2 * % p i * f a * C 1 ) ; / / U s i n g f a = 1/ (2∗ %p i ∗ Rf ∗C1 )
10 printf ( ” \n Feed ba ck r e s i s t a n c e i s = %. 1 f ohm \n” , R f )11 R f = 1 . 5 * 1 0 ^ 3 ; / / A p p ro x i ma t i o n12 f b = 2 0 * 1 0 ^ 3 ; // Gain l i m i t i n g f r e q13 R 1 = 1 / ( 2 * % p i * f b * C 1 ) ;
14 printf ( ” \n R e s i s t a nc e , R1 i s = %. 1 f ohm \n” , R 1 )15 R 1 = 8 2 ; / / A p p ro x i m at i o n16 C f = R 1 * C 1 / R f ;
17 printf ( ” \n C a pa c it a nc e , Cf i s = %. 1 0 f f a r a d \n” , C f )
18 C f = 0 . 0 0 5 * 1 0 ^ - 6 ; / / A p p ro x i m at i o n
51
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
53/92
Scilab code Exa 6.16.b Output waveform of differentiator
1 / / C h a pt e r62 // P age . No−2383 // E xa mp le 6 1 6 b4 // Output w aveform o f d i f f e r e n t i a t o r5 / / G iv en6 clear ; clc ;
7 s t e p = 0 . 0 1 ;
8 t = 0 : s t e p : 2 * % p i ;
9 dy = diff ( sin ( t ) ) / s t e p ; // a p pr ox im at e d i f f e r e n t i a t i o no f s i n e f u n c t i o n
10 V o = - 1 . 5 * 1 0 ^ 3 * 0 . 1 * 1 0 ^ - 6 * 2 * % p i * 1 0 ^ 3 * d y ;
11 plot ( V o ) ;
12 t i t l e ( ’ O ut pu t V o l t a g e ’ ) ;13 x l a b e l ( ’ t ’ ) ;14 y l a b e l ( ’ Vo ’ ) ;
52
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
54/92
Chapter 7
Active Filters and Oscillators
Scilab code Exa 7.1 Design of low pass filter
1 / / C h a pt e r72 // P age . No−2563 / / E xa mp le 7 14 / / D es i gn o f l ow p a s s f i l t e r5 / / G iv en6 clear ; clc ;
7 f h = 1 * 1 0 ^ 3 ; / / Cut− o f f f r eq u en c y8 C = 0 . 0 1 * 1 0 ^ - 6 ; / / A s s um p t io n9 R = 1 / ( 2 * % p i * f h * C ) ;
10 printf ( ” \n R e s i s t a n ce R i s = %. 1 f ohm \n” ,R ) //R e s u l t
11 printf ( ” \n U se 2 0 kohm POT a s R \n” )12 R 1 = 1 0 * 1 0 ^ 3 ; / / A s s um p t io n13 printf ( ” \n R e s i s t a n ce R1 i s = %. 1 f ohm \n” , R 1 )14 R f = R 1 ; // S i c e p as sb an d g a in i s 2 , R1 a nd Rf must be
e q u a l
15 printf ( ” \n R e s i s t a n ce Rf i s = %. 1 f ohm \n” , R f )
53
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
55/92
This code can be downloaded from the website wwww.scilab.in
Scilab code Exa 7.2 Design of low pass filter
1 / / C h a pt e r72 // P age . No−2563 / / E xa mp le 7 24 / / D es i gn o f l ow p a s s f i l t e r5 / / G iv en6 clear ; clc ;
7 f c 0 = 1 * 1 0 ^ 3 ; // O r i g i na l cut − o f f f r eq u en c y8 f c 1 = 1 . 6 * 1 0 ^ 3 ; // New c ut−o f f f r e q ue n cy9 R = 1 5 . 9 * 1 0 ^ 3 ; // O r i g i n a l r e s i s t a n c e v al ue
10 k = f c 0 / f c 1 ;
11 R n e w = R * k ;
12 printf ( ” \n New R e s i s t a n c e Rnew i s = %. 1 f ohm \n” ,
R n e w ) // R e su l t
Scilab code Exa 7.3 Frequency response of low pass filter
1 / / C h a pt e r72 // P age . No−257
3 / / E xa mp le 7 34 / / F re qu en cy r e s p o n s e o f l ow p a s s f i l t e r5 / / G iv en6 clear ; clc ;
7 A f = 2 ; / / P as sb an d g a i n o f t h e f i l t e r
54
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
56/92
8 f h = 1 0 0 0 ; / / Cut− o f f f r eq u en c y
9 f 1 = 1 0 ; // I np ut f r e q i n Hz10 a v 1 = A f / sqrt ( 1 + ( f 1 / f h ) ^ 2 ) ;11 printf ( ” \n Gain m ag ni tu de av1 a t f 1 i s = %. 2 f \n” ,
a v 1 ) // R e su l t12 f 2 = 1 0 0 ; // Freq i n Hz13 a v 2 = A f / sqrt ( 1 + ( f 2 / f h ) ^ 2 ) ;
14 printf ( ” \n Gain m ag ni tu de av2 a t f 2 i s = %. 2 f \n” ,a v 2 ) // R e su l t
15 f 3 = 2 0 0 ; // Freq i n Hz16 a v 3 = A f / sqrt ( 1 + ( f 3 / f h ) ^ 2 ) ;
17 printf ( ” \n Gain m ag ni tu de av3 a t f 3 i s = %. 2 f \n” ,
a v 3 ) // R e su l t18 f 4 = 7 0 0 ; // Freq i n Hz19 a v 4 = A f / sqrt ( 1 + ( f 4 / f h ) ^ 2 ) ;
20 printf ( ” \n Gain m ag ni tu de av4 a t f 4 i s = %. 2 f \n” ,a v 4 ) // R e su l t
21 f 5 = 1 0 0 0 ; // Fre q i n Hz22 a v 5 = A f / sqrt ( 1 + ( f 5 / f h ) ^ 2 ) ;
23 printf ( ” \n Gain m ag ni tu de av5 a t f 5 i s = %. 2 f \n” ,a v 5 ) // R e su l t
24 f 6 = 3 0 0 0 ; // Fre q i n Hz25 a v 6 = A f / sqrt ( 1 + ( f 6 / f h ) ^ 2 ) ;
26 printf ( ” \n Gain m ag ni tu de av6 a t f 6 i s = %. 2 f \n” ,a v 6 ) // R e su l t
27 f 7 = 7 0 0 0 ; // Fre q i n Hz28 a v 7 = A f / sqrt ( 1 + ( f 7 / f h ) ^ 2 ) ;
29 printf ( ” \n Gain m ag ni tu de av7 a t f 7 i s = %. 2 f \n” ,a v 7 ) // R e su l t
30 f 8 = 1 0 0 0 0 ; // Fr eq i n Hz31 a v 8 = A f / sqrt ( 1 + ( f 8 / f h ) ^ 2 ) ;
32 printf ( ” \n Gain m ag ni tu de av8 a t f 8 i s = %. 2 f \n” ,a v 8 ) // R e su l t
33 f 9 = 3 0 0 0 0 ; // Fr eq i n Hz34 a v 9 = A f / sqrt ( 1 + ( f 9 / f h ) ^ 2 ) ;
35 printf ( ” \n Gain m ag ni tu de av9 a t f 9 i s = %. 2 f \n” ,a v 9 ) // R e su l t
36 f 1 0 = 1 0 0 0 0 0 ; // Fr eq i n Hz
55
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
57/92
37 a v 1 0 = A f / sqrt ( 1 + ( f 1 0 / f h ) ^ 2 ) ;
38 printf ( ” \n Gain m ag ni tu de a v1 0 a t f 1 0 i s = %. 2 f \n” ,a v 1 0 ) // R e su l t39 x =[ f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 ];
40 y = [ av 1 a v2 a v3 a v4 a v5 a v6 a v7 a v8 a v9 a v1 0 ];
41 gainplot ( x , y ) ;
42 t i t l e ( ’ F r e q u e n c y R e s p o n s e ’ ) ;43 x l a b e l ( ’ Frequenc y (Hz) ’ ) ;44 y l a b e l ( ’ V o l t a g e g a i n ( dB ) ’ ) ;
Scilab code Exa 7.4.a Design of second order low pass filter
1 / / C h a pt e r72 // P age . No−2563 // E xa mp le 7 4 a4 / / D es i gn o f s e co n d o r d e r l ow p a s s f i l t e r5 / / G iv en6 clear ; clc ;
7 f h = 1 * 1 0 ^ 3 ; / / Cut− o f f f r eq u en c y8 C 2 = 0 . 0 0 4 7 * 1 0 ^ - 6 ; / / A s s um p t io n9 C 3 = C 2 ;
10 R 2 = 1 / ( 2 * % p i * f h * C 2 ) ;
11 printf ( ” \n R e s i s t a n ce R2 i s = %. 1 f ohm \n” , R 2 ) //R e s u l t
12 R 2 = 3 3 * 1 0 ^ 3 ; / / A p p ro x i m at i o n13 R 3 = R 2 ;
14 printf ( ” \n R e s i s t a n ce R3 i s = %. 1 f ohm \n” , R 3 ) //R e s u l t
15 R 1 = 2 7 * 1 0 ^ 3 ; / / A s s um p t io n16 R f = 0 . 5 8 6 * R 1 ;17 printf ( ” \n R e s i s t a n ce Rf i s = %. 1 f ohm \n” , R f ) //
R e s u l t18 printf ( ” \n U se 2 0 kohm POT a s R f \n” )
56
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
58/92
Scilab code Exa 7.4.b Frequency response of second order highpass filter
1 / / C h a pt e r72 // P age . No−2603 // E xa mp le 7 4 b4 // F re qu en cy r e s p on s e o f s ec on d o r d er h i g h pa s s
f i l t e r5 / / G iv en6 clear ; clc ;
7 A f = 1 . 5 8 6 ; / / P as sb an d g a i n o f t h e f i l t e r8 f h = 1 0 0 0 ; / / Cut− o f f f r eq u en c y9 f 1 = 1 0 ; // I np ut f r e q i n Hz
10 a v 1 = A f / sqrt ( 1 + ( f 1 / f h ) ^ 4 ) ;
11 printf ( ” \n Gain m ag ni tu de av1 a t f 1 i s = %. 2 f \n” ,a v 1 ) // R e su l t
12 f 2 = 1 0 0 ; // Freq i n Hz13 a v 2 = A f / sqrt ( 1 + ( f 2 / f h ) ^ 4 ) ;
14 printf ( ” \n Gain m ag ni tu de av2 a t f 2 i s = %. 2 f \n” ,a v 2 ) // R e su l t
15 f 3 = 2 0 0 ; // Freq i n Hz16 a v 3 = A f / sqrt ( 1 + ( f 3 / f h ) ^ 4 ) ;
17 printf ( ” \n Gain m ag ni tu de av3 a t f 3 i s = %. 2 f \n” ,a v 3 ) // R e su l t
18 f 4 = 7 0 0 ; // Freq i n Hz19 a v 4 = A f / sqrt ( 1 + ( f 4 / f h ) ^ 4 ) ;
20 printf ( ” \n Gain m ag ni tu de av4 a t f 4 i s = %. 2 f \n” ,a v 4 ) // R e su l t
21 f 5 = 1 0 0 0 ; // Fre q i n Hz22 a v 5 = A f / sqrt ( 1 + ( f 5 / f h ) ^ 4 ) ;
23 printf ( ” \n Gain m ag ni tu de av5 a t f 5 i s = %. 2 f \n” ,a v 5 ) // R e su l t
24 f 6 = 3 0 0 0 ; // Fre q i n Hz
57
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
59/92
25 a v 6 = A f / sqrt ( 1 + ( f 6 / f h ) ^ 4 ) ;
26 printf ( ” \n Gain m ag ni tu de av6 a t f 6 i s = %. 2 f \n” ,a v 6 ) // R e su l t27 f 7 = 7 0 0 0 ; // Fre q i n Hz28 a v 7 = A f / sqrt ( 1 + ( f 7 / f h ) ^ 4 ) ;
29 printf ( ” \n Gain m ag ni tu de av7 a t f 7 i s = %. 2 f \n” ,a v 7 ) // R e su l t
30 f 8 = 1 0 0 0 0 ; // Fr eq i n Hz31 a v 8 = A f / sqrt ( 1 + ( f 8 / f h ) ^ 4 ) ;
32 printf ( ” \n Gain m ag ni tu de av8 a t f 8 i s = %. 2 f \n” ,a v 8 ) // R e su l t
33 f 9 = 3 0 0 0 0 ; // Fr eq i n Hz
34 a v 9 = A f / sqrt ( 1 + ( f 9 / f h ) ^ 4 ) ;35 printf ( ” \n Gain m ag ni tu de av9 a t f 9 i s = %. 5 f \n” ,
a v 9 ) // R e su l t36 f 1 0 = 1 0 0 0 0 0 ; // Fr eq i n Hz37 a v 1 0 = A f / sqrt ( 1 + ( f 1 0 / f h ) ^ 4 ) ;
38 printf ( ” \n Gain m ag ni tu de a v1 0 a t f 1 0 i s = %. 6 f \n” ,a v 1 0 ) // R e su l t
39 x =[ f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 ];
40 y = [ av 1 a v2 a v3 a v4 a v5 a v6 a v7 a v8 a v9 a v1 0 ];
41 gainplot ( x , y ) ;
42 t i t l e ( ’ F r e q u e n c y R e s p o n s e ’
) ;
43 x l a b e l ( ’ Frequenc y (Hz) ’ ) ;44 y l a b e l ( ’ V o l t a g e g a i n ( dB ) ’ ) ;
Scilab code Exa 7.5.a Design of highpass filter
1 / / C h a pt e r72 // P age . No−2633 // E xa mp le 7 5 a4 / / D es i gn o f h i g h p a s s f i l t e r5 / / G iv en
58
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
60/92
6 clear ; clc ;
7 f h = 1 * 1 0 ^ 3 ; / / Cut− o f f f r eq u en c y8 A f = 2 ; / / P as sb an d g a i n o f t h e f i l t e r9 C = 0 . 0 1 * 1 0 ^ - 6 ; / / A s s um p t io n
10 R = 1 / ( 2 * % p i * f h * C ) ;
11 printf ( ” \n R e s i s t a n ce R i s = %. 1 f ohm \n” ,R ) //R e s u l t
12 printf ( ” \n U se 2 0 kohm POT a s R \n” )13 R 1 = 1 0 * 1 0 ^ 3 ; / / A s s um p t io n14 printf ( ” \n R e s i s t a n ce R1 i s = %. 1 f ohm \n” , R 1 )15 R f = R 1 ; // S i c e p as sb an d g a in i s 2 , R1 a nd Rf must be
e q u a l
16 printf ( ” \n R e s i s t a n ce Rf i s = %. 1 f ohm \n” , R f )
Scilab code Exa 7.5.b Frequency response of highpass filter
1 / / C h a pt e r72 // P age . No−263
3 // E xa mp le 7 5 b4 / / F re qu en cy r e s p o n s e o f h i g h p a s s f i l t e r5 / / G iv en6 clear ; clc ;
7 A f = 2 ; / / P as sb an d g a i n o f t h e f i l t e r8 f l = 1 0 0 0 ; / / Cut− o f f f r eq u en c y9 f 1 = 1 0 0 ; // I np u t f r e q i n Hz
10 a v 1 = ( A f * ( f 1 / f l ) ) / sqrt ( 1 + ( f 1 / f l ) ^ 2 ) ;
11 printf ( ” \n Gain m ag ni tu de av1 a t f 1 i s = %. 2 f \n” ,a v 1 ) // R e su l t
12 f 2 = 2 0 0 ; // Freq i n Hz13 a v 2 = ( A f * ( f 2 / f l ) ) / sqrt ( 1 + ( f 2 / f l ) ^ 2 ) ;14 printf ( ” \n Gain m ag ni tu de av2 a t f 2 i s = %. 2 f \n” ,
a v 2 ) // R e su l t15 f 3 = 4 0 0 ; // Freq i n Hz
59
-
8/20/2019 Op-Amps and Linear Integrated Circuits_R. a. Gayakwad_2
61/92
16 a v 3 = ( A f * ( f 3 / f l ) ) / sqrt ( 1 + ( f 3 / f l ) ^ 2 ) ;
17 printf ( ” \n Gain m ag ni tu de av3 a t f 3 i s = %. 2 f \n” ,a v 3 ) // R e su l t18 f 4 = 7 0 0 ; // Freq i n Hz19 a v 4 = ( A f * ( f 4 / f l ) ) / sqrt ( 1 + ( f 4 / f l ) ^ 2 ) ;
20 printf ( ” \n Gain m ag ni tu de av4 a t f 4 i s = %. 2 f \n” ,a v 4 ) // R e su l t
21 f 5 = 1 0 0 0 ; // Fre q i n Hz22 a v 5 = ( A f * ( f 5 / f l ) ) / sqrt ( 1 + ( f 5 / f l ) ^ 2 ) ;
23 printf ( ” \n Gain m ag ni tu de av5 a t f 5 i s = %. 2 f \n” ,a v 5 ) // R e su l t
24 f 6 = 3 0 0 0 ; // Fre q i n Hz
25 a v 6 = ( A f * ( f 6 / f l ) ) / sqrt ( 1 + ( f 6 / f l ) ^ 2 ) ;26 printf ( ” \n Gain m ag ni tu de av6 a t f 6 i s = %. 2 f \n” ,
a v 6 ) // R e su l t27 f 7 = 7 0 0 0 ; // Fre q i n Hz28 a v 7 = ( A f * ( f 7 / f l ) ) / sqrt ( 1 + ( f 7 / f l ) ^ 2 ) ;
29 printf ( ” \n Gain m ag ni tu de av7 a t f 7 i s = %. 2 f \n” ,a v 7 ) // R e su l t
30 f 8 = 1 0 0 0 0 ; // Fr eq i n Hz31 a v 8 = ( A f * ( f 8 / f l ) ) / sqrt ( 1 + ( f 8 / f l ) ^ 2 ) ;
32 printf ( ” \n Gain m ag ni tu de av8 a t f 8 i s = %. 2 f \n” ,a v 8 )
// R e su l t33 f 9 = 3 0 0 0 0 ; // Fr eq i n Hz34 a v 9 = ( A f * ( f 9 / f l ) ) / sqrt ( 1 + ( f 9 / f l ) ^ 2 ) ;
35 printf ( ” \n Ga