0% found this document useful (0 votes)
2K views120 pages

Electronic Circuits - P. Raja

This document provides a list of Scilab codes that correspond to examples from the textbook "Electronic Circuits" by P. Raja. There are over 100 codes listed, organized by the chapter of the textbook they relate to, including codes for operational amplifiers, MOSFETs, bipolar junction transistors, differential amplifiers, and feedback amplifiers. The codes were created by Amit Sexana and cross-checked by Lavitha Pereira to accompany examples from the textbook for educational use with Scilab.

Uploaded by

abhishek
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views120 pages

Electronic Circuits - P. Raja

This document provides a list of Scilab codes that correspond to examples from the textbook "Electronic Circuits" by P. Raja. There are over 100 codes listed, organized by the chapter of the textbook they relate to, including codes for operational amplifiers, MOSFETs, bipolar junction transistors, differential amplifiers, and feedback amplifiers. The codes were created by Amit Sexana and cross-checked by Lavitha Pereira to accompany examples from the textbook for educational use with Scilab.

Uploaded by

abhishek
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 120

Scilab Textbook Companion for

Electronic Circuits
by P. Raja1

Created by
Amit Sexana
B.Tech
Electronics Engineering
UPTU
College Teacher
Mr. Sunil Kumar
Cross-Checked by
Lavitha Pereira

July 31, 2019

1 Funded by a grant from the National Mission on Education through ICT,


http://spoken-tutorial.org/NMEICT-Intro. This Textbook Companion and Scilab
codes written in it can be downloaded from the ”Textbook Companion Project”
section at the website http://scilab.in
Book Description

Title: Electronic Circuits

Author: P. Raja

Publisher: Umesh Publications, Darya Ganj, New Delhi

Edition: 2

Year: 2012

ISBN: 978-93-8017613-0

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.

2
Contents

List of Scilab Codes 4

1 Operational Amplifiers 5

2 MOSFET 23

3 Bipolar Junction Transistors 44

4 Differential Amplifiers 74

5 Feedback Amplifiers 91

6 Oscillators 106

7 Examintion Paper 114

3
List of Scilab Codes

Exa 1.1 Value of Rf . . . . . . . . . . . . . . . . . . 5


Exa 1.2 Output voltage . . . . . . . . . . . . . . . . 5
Exa 1.3 Inverting amplifier . . . . . . . . . . . . . . 6
Exa 2.3 Value of ID and VDS . . . . . . . . . . . . . 6
Exa 1.4 Output voltage . . . . . . . . . . . . . . . . 7
Exa 1.5 Output voltage . . . . . . . . . . . . . . . . 8
Exa 1.6 Maximum and minimum closed loop gain . . 9
Exa 1.7 Output voltage . . . . . . . . . . . . . . . . 9
Exa 1.8 Voltage gain . . . . . . . . . . . . . . . . . . 10
Exa 1.10 Output voltage . . . . . . . . . . . . . . . . 10
Exa 1.11 Range of voltage gain . . . . . . . . . . . . . 11
Exa 1.12 Range of output voltage . . . . . . . . . . . 12
Exa 1.13 The value of R1 and R2 . . . . . . . . . . . 12
Exa 1.14 Output voltage . . . . . . . . . . . . . . . . 13
Exa 1.15 Output voltage . . . . . . . . . . . . . . . . 14
Exa 1.16 Ouptut voltage . . . . . . . . . . . . . . . . 14
Exa 1.17 Output voltage . . . . . . . . . . . . . . . . 15
Exa 1.18 Output voltage . . . . . . . . . . . . . . . . 15
Exa 1.19 Output voltage . . . . . . . . . . . . . . . . 16
Exa 1.20 Output voltage . . . . . . . . . . . . . . . . 17
Exa 1.22 Inverting op amp . . . . . . . . . . . . . . . 17
Exa 1.24 Output voltage . . . . . . . . . . . . . . . . 18
Exa 1.25 Output voltage . . . . . . . . . . . . . . . . 18
Exa 1.26 Gain . . . . . . . . . . . . . . . . . . . . . . 19
Exa 1.27 Value of Ao fb fr . . . . . . . . . . . . . . . 20
Exa 1.28 3dB frequency and gain . . . . . . . . . . . 21
Exa 2.1 Device operate region . . . . . . . . . . . . . 23
Exa 2.2 Drain current . . . . . . . . . . . . . . . . . 25

4
Exa 2.4 Value of VGS RS and RD . . . . . . . . . . 26
Exa 2.5 Value required of R . . . . . . . . . . . . . . 27
Exa 2.6 Value of R and VD . . . . . . . . . . . . . . 27
Exa 2.7 Effective resistance between drain and source 28
Exa 2.8 Voltages at all nodes . . . . . . . . . . . . . 29
Exa 2.9 Value of ID and VDS . . . . . . . . . . . . . 30
Exa 2.10 Design a bias circuit . . . . . . . . . . . . . 31
Exa 2.11 Bias point . . . . . . . . . . . . . . . . . . . 32
Exa 2.12 Largest value of RD . . . . . . . . . . . . . 33
Exa 2.14 Resistance value . . . . . . . . . . . . . . . 34
Exa 2.15 Required value of VGS and minimum value
of VDS . . . . . . . . . . . . . . . . . . . . 35
Exa 2.16 Value of RD and RS . . . . . . . . . . . . . 36
Exa 2.17 Required value of R and W . . . . . . . . . 36
Exa 2.18 Required value of gate width . . . . . . . . 37
Exa 2.19 Value of V1 V2 V3 V4 and V5 . . . . . . . 38
Exa 2.20 Labelled current and voltage . . . . . . . . . 39
Exa 2.22 Voltage gain . . . . . . . . . . . . . . . . . . 40
Exa 2.23 Value of CS . . . . . . . . . . . . . . . . . . 42
Exa 2.24 Midband gain and upper 3 dB frequency . . 42
Exa 3.1 Value of IE IB IC and VC . . . . . . . . . . 44
Exa 3.2 Value of alpha and bita . . . . . . . . . . . 45
Exa 3.3 Bias voltage . . . . . . . . . . . . . . . . . . 45
Exa 3.4 Design a fixed bias circuit . . . . . . . . . . 47
Exa 3.5 Operating point . . . . . . . . . . . . . . . . 47
Exa 3.6 Q point values . . . . . . . . . . . . . . . . 48
Exa 3.7 Collector to base bias circuit . . . . . . . . . 49
Exa 3.8 Value of RB . . . . . . . . . . . . . . . . . 50
Exa 3.9 Operating point . . . . . . . . . . . . . . . . 50
Exa 3.10 Voltage gain . . . . . . . . . . . . . . . . . . 51
Exa 3.11 All node voltages and currents . . . . . . . . 52
Exa 3.12 All node voltage and all branch current . . . 53
Exa 3.13 All node voltage and all branch current . . . 54
Exa 3.14 Region in which Q point lie . . . . . . . . . 55
Exa 3.16 Value of Bita . . . . . . . . . . . . . . . . . 55
Exa 3.17 Value of alpha . . . . . . . . . . . . . . . . . 56
Exa 3.18 Value of Is Ic and VBE . . . . . . . . . . . . 57
Exa 3.19 Transistor model . . . . . . . . . . . . . . . 58

5
Exa 3.20 Labelled current and voltage . . . . . . . . . 58
Exa 3.21 Value of Bita and labelled voltage . . . . . . 60
Exa 3.22 The emitter base and collector voltage and
current . . . . . . . . . . . . . . . . . . . . . 61
Exa 3.23 Value of VE VC and alpha bita . . . . . . . 63
Exa 3.24 Current flow . . . . . . . . . . . . . . . . . . 64
Exa 3.25 Voltage gain . . . . . . . . . . . . . . . . . . 64
Exa 3.27 Value of VB VC and VE . . . . . . . . . . . 65
Exa 3.28 Value of VE and VC . . . . . . . . . . . . . 66
Exa 3.29 Value of VB IB IE IC VC alpha and bita . . 67
Exa 3.30 DC voltage and value of gm . . . . . . . . . 68
Exa 3.31 Input resistance and overall voltage gain . . 68
Exa 3.32 Input resistance and overall voltage gain . . 69
Exa 3.33 Value of alpha bita and Is . . . . . . . . . . 70
Exa 4.1 Value of ic1 and vce1 . . . . . . . . . . . . . 74
Exa 4.2 Value of VOV and VGS . . . . . . . . . . . 75
Exa 4.3 Required values of WbyL . . . . . . . . . . 77
Exa 4.4 Value of VOV gm ro and Ad . . . . . . . . . 78
Exa 4.5 Differential gain . . . . . . . . . . . . . . . . 79
Exa 4.6 CMRR . . . . . . . . . . . . . . . . . . . . . 80
Exa 4.7 Value of VE VC1 and VC2 . . . . . . . . . . 81
Exa 4.8 Input differential signal . . . . . . . . . . . . 82
Exa 4.9 Input differential resistance . . . . . . . . . 82
Exa 4.10 Three components of input offset voltage . . 84
Exa 4.11 Value of Gm Ro Ad Acm and CMRR . . . . 85
Exa 4.12 Value of Gm Ro Ad and Rid . . . . . . . . . 86
Exa 4.13 Value of VOV and VGS . . . . . . . . . . . 86
Exa 4.14 Ratio of W and L . . . . . . . . . . . . . . . 88
Exa 4.15 Value of VOV gm ro and Ad . . . . . . . . . 88
Exa 4.16 Voltage at emitter and outputs . . . . . . . 89
Exa 5.1 Percentage of output which is feedback to in-
put . . . . . . . . . . . . . . . . . . . . . . . 91
Exa 5.2 Value of alpha and bita . . . . . . . . . . . 91
Exa 5.3 Value of fL and fH . . . . . . . . . . . . . . 92
Exa 5.4 Value of Bita and Af . . . . . . . . . . . . . 92
Exa 5.5 Fraction of the output that is feebback to input 93
Exa 5.6 Fraction of the output voltage feedback . . . 93
Exa 5.7 Percentage reduction in stage gain . . . . . 94

6
Exa 5.8 Bandwidth of a feedback amplifiers . . . . . 95
Exa 5.10 Value of Av bita Avf Ri Rif Ro Rof . . . . . 95
Exa 5.11 Value of Avf Rif Rof and bita . . . . . . . . 96
Exa 5.12 Value of D Gmf Rif and Rof . . . . . . . . . 97
Exa 5.19 Percentage change in Af . . . . . . . . . . . 98
Exa 5.20 Percentage gain deduction . . . . . . . . . . 99
Exa 5.21 Open loop gain and loop gain . . . . . . . . 99
Exa 5.22 Value of AB . . . . . . . . . . . . . . . . . . 100
Exa 5.23 Gain densitivity factor . . . . . . . . . . . . 101
Exa 5.24 Upper and lower 3dB frequency . . . . . . . 102
Exa 5.25 Value of alpha and bita . . . . . . . . . . . 103
Exa 5.26 Value of alpha and bita . . . . . . . . . . . 103
Exa 5.28 Gain input resistance and output resistance
of the closed loop amp . . . . . . . . . . . . 104
Exa 5.29 Closed loop voltage gain . . . . . . . . . . . 105
Exa 6.1 Minimum gain of the amplifier to provide os-
cillation . . . . . . . . . . . . . . . . . . . . 106
Exa 6.2 The frequency of oscillation . . . . . . . . . 106
Exa 6.3 Wein Bridge oscillator . . . . . . . . . . . . 107
Exa 6.4 Frequency of oscillations . . . . . . . . . . . 108
Exa 6.5 Operating frequency . . . . . . . . . . . . . 108
Exa 6.6 Operating frequency . . . . . . . . . . . . . 109
Exa 6.7 Frequency of oscillaiton . . . . . . . . . . . 110
Exa 6.8 Value of fs and fp . . . . . . . . . . . . . . . 110
Exa 6.10 Frequency of oscillaiton . . . . . . . . . . . 111
Exa 6.11 Value of C . . . . . . . . . . . . . . . . . . . 111
Exa 6.12 Frequency of oscillaiton and minimum gain . 112
Exa 6.14 The range of capacitance . . . . . . . . . . . 113
Exa 1.b The value of V1 and V0 . . . . . . . . . . . 114
Exa 2.a The value of ID and VD . . . . . . . . . . . 114
Exa 2.c ON resistance of an NMOS transistor . . . . 115
Exa 3.b The value of RE RB and delta ICQ . . . . . 116

7
Chapter 1

Operational Amplifiers

Scilab code Exa 1.1 Value of Rf

1 // Exa 1 . 1
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 G = -100;
7 R1 = 2.2; // i n kohm
8 R1 = R1 *10^3; // i n ohm
9 // Formula G=−Rf /R1
10 Rf = -G * R1 ;
11 disp ( Rf *10^ -3 , ” The v a l u e o f Rf i n kohm i s ” )

Scilab code Exa 1.2 Output voltage

1 // Exa 1 . 2
2 clc ;
3 clear ;
4 close ;

8
5 // Given d a t a
6 Rf = 200; // i n kohm
7 R1 = 2; // i n kohm
8 vin =2.5; // i n mV
9 vin = vin *10^ -3; // i n v o l t
10 G = - Rf / R1 ;
11 vo = G * vin ; // i n V
12 disp ( vo , ” The o u t p u t v o l t a g e i n v o l t i s : ” )

Scilab code Exa 1.3 Inverting amplifier

1 // Exa 1 . 3
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 G = -10;
7 Ri = 100; // i n kohm
8 R1 = Ri ; // i n kohm
9 R1 = R1 *10^3; // i n ohm
10 // Formula G=−R2/R1
11 R2 = R1 * abs ( G ) ; // ohm
12 disp ( R1 *10^ -3 , ” V a l u e o f R1 i n kohm i s : ” )
13 disp ( R2 *10^ -6 , ” and v a l u e o f R2 i n Mohm i s : ” )

Scilab code Exa 2.3 Value of ID and VDS

1 // Exa 2 . 3
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 Vt = 0.7; // i n V

9
7 I_D = 100; // i n A
8 I_D = I_D *10^ -6; // i n A
9 // When
10 V_GS = 1.2; // i n V
11 V_DS = V_GS ; // i n V
12 // At t h i s c o n d i t i o n , d e v i c e i s in saturation region
, so I D= unCox ∗W/ ( 2 ∗ L ) ∗ ( V GS−VT) ˆ2
13 unCoxWby2L = I_D /( V_GS - Vt ) ^2;
14 // For
15 V_DS = 3; // i n V
16 V_GS = 1.5; // i n V
17 // I n t h i s c o n d i t i o n , d e v i c e i s i n s a t u r a t i o n r e g i o n
, so
18 I_D = unCoxWby2L *( V_GS - Vt ) ^2; // i n A
19 disp ( I_D *10^6 , ” For V DS= 3V and V GS= 1 . 5 V, The
value of I D in A i s : ”)
20 // For
21 V_GS = 3.2; // i n V
22 r_DS = 1/(2* unCoxWby2L *( V_GS - Vt ) ) ; // i n
23 disp ( r_DS , ” For V GS = 3 . 2 V, D r a i n t o s o u r c e
r e s i s t a n c e in i s : ”)

Scilab code Exa 1.4 Output voltage

1 // Exa 1 . 4
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 R1 = 100; // i n kohm
7 R2 = 500; // i n kohm
8 V1 = 2; // i n v o l t
9 Vo = (1+ R2 / R1 ) * V1 ; // i n v o l t
10 disp ( Vo , ” Output v o l t a g e f o r n o n i n v e r t i n g a m p l i f i e r
in v o l t ”)

10
Scilab code Exa 1.5 Output voltage

1 // Exa 1 . 5
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 Rf = 1; // i n Mohm
7 Rf = Rf *10^6; // i n ohm
8
9 // P a r t ( a )
10 V1 =1; // i n v o l t
11 V2 =2; // i n v o l t
12 V3 =3; // i n v o l t
13 R1 = 500; // i n kohm
14 R1 = R1 *10^3; // i n ohm
15 R2 = 1; // i n Mohm
16 R2 = R2 *10^6; // i n ohm
17 R3 = 1; // i n Mohm
18 R3 = R3 *10^6; // i n ohm
19 Vo = - Rf *( V1 / R1 + V2 / R2 + V3 / R3 ) ; // i n v o l t
20 disp ( Vo , ” ( a ) Output v o l t a g e i n v o l t i s : ” )
21
22 // P a r t ( b )
23 V1 = -2; // i n v o l t
24 V2 =3; // i n v o l t
25 V3 =1; // i n v o l t
26 R1 = 200; // i n kohm
27 R1 = R1 *10^3; // i n ohm
28 R2 = 500; // i n kohm
29 R2 = R2 *10^3; // i n ohm
30 R3 = 1; // i n Mohm
31 R3 = R3 *10^6; // i n ohm
32 Vo = - Rf *( V1 / R1 + V2 / R2 + V3 / R3 ) ; // i n v o l t

11
33 disp ( Vo , ” ( b ) Output v o l t a g e i n v o l t i s : ” )

Scilab code Exa 1.6 Maximum and minimum closed loop gain

1 // Exa 1 . 6
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 disp ( ”Minimum c l o s e d l o o p v o l t a g e g a i n f o r R2=0 and
R1= 2 kohm” )
7 R2 =0;
8 R1 =2; // i n kohm
9 R1 = R1 *10^3; // i n ohm
10 Av_min = (1+ R2 / R1 )
11 disp ( Av_min )
12
13 disp ( ”Maximum c l o s e d l o o p v o l t a g e g a i n f o r maximum
v a l u e o f R2=100 kohm and R1= 2 kohm” )
14 R2 =100; // i n kohm
15 R1 =2; // i n kohm
16 Av_max = (1+ R2 / R1 )
17 disp ( Av_max )

Scilab code Exa 1.7 Output voltage

1 // Exa 1 . 7
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V1 = 745; // i n V
7 V2 = 740; // i n V

12
8 V1 = V1 *10^ -6; // i n v o l t
9 V2 = V2 *10^ -6; // i n v o l t
10 CMRR =80; // i n dB
11 Av =5*10^5;
12 // ( i )
13 // CMRR i n dB= 20∗ l o g ( Ad/Ac )
14 Ad = Av ;
15 Ac = Ad /10^( CMRR /20) ;
16 // ( i i )
17 Vo = Ad *( V1 - V2 ) + Ac *( V1 + V2 ) /2;
18 disp ( Vo , ” Output v o l t a g e i n v o l t i s : ” )
19
20 // Note :− I n t h e book , t h e r e i s c a l c u l a t i o n e r r o r t o
e v a l u a t e t h e v a l u e o f Ac , s o t h e v a l u e o f Ac i s
wrong a n s t o e v a l u a t e t h e o u t p u t v o l t a g e t h e r e i s
also calculation error

Scilab code Exa 1.8 Voltage gain

1 // Exa 1 . 8
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 R1 = 1; // i n Mohm
7 Ri = R1 ; // i n Mohm
8 Rf =1; // i n Mohm
9 A_VF = - Rf / R1 ;
10 disp ( A_VF , ” V o l t a g e g a i n i s : ” )

Scilab code Exa 1.10 Output voltage

1 // Exa 1 . 1 0

13
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V1 =2; // i n V
7 V2 =3; // i n V
8 Rf =3; // i n kohm
9 R1 =1; // i n kohm
10 disp ( ” Output v o l t a g e when o n l y 2V v o l t a g e s o u r c e i s
a c t i n g in v o l t ”)
11 Vo1 = (1+ Rf / R1 ) * V1 ;
12 disp ( Vo1 ) ;
13 disp ( ” Output v o l t a g e due t o 3V v o l t a g e s o u r c e i n
v o l t ”)
14 Vo2 = (1+ Rf / R1 ) * V2 ;
15 disp ( Vo2 ) ;
16 Vo = Vo1 + Vo2 ; // i n v o l t s
17 disp ( Vo , ” T o t a l o u t p u t v o l t a g e i n v o l t s ” )

Scilab code Exa 1.11 Range of voltage gain

1 // Exa 1 . 1 1
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 Rf =500; // i n kohm
7 min_vvs = 0; // minimum v a l u e o f variable r e s i s t o r in
ohm
8 max_vvs = 10; // maximum v a l u e o f v a r i a b l e r e s i s t o r i n
ohm
9 Ri_min = 10+ min_vvs ; // i n kohm
10 Ri_max = 10+ max_vvs ; // i n kohm
11 // Av= Vo/ Vi= −Rf / Ri
12 disp ( ” C l o s e d l o o p v o l t a g e g a i n c o r r e s p o n d i n g t o Ri (

14
min ) i s ” )
13 Av = - Rf / Ri_min ;
14 disp ( Av )
15 disp ( ” and c l o s e d l o o p v o l t a g e g a i n c o r r e s p o n d i n g t o
Ri ( max ) i s ” )
16 Av = - Rf / Ri_max ;
17 disp ( Av )
18 disp ( ” Thus t h e c l o s e d l o o p g a i n o f t h e c i r c u i t can
be a d j u s t e d a t any v a l u e b e t w e e n −25 t o −50 w i t h
the help of v a r i a b l e r e s i s t o r . ”)

Scilab code Exa 1.12 Range of output voltage

1 // Exa 1 . 1 2
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 Rf =200; // i n kohm
7 R1 = 20; // i n kohm
8 // Av= Vo/ Vi= −Rf / Ri
9 Av = - Rf / R1 ;
10 Vi_min = 0.1; // i n V
11 Vi_max = 0.5; // i n V
12 // Vo= Av∗ Vi
13 Vo_min = Av * Vi_min ; // i n V
14 Vo_max = Av * Vi_max ; // i n V
15 disp ( ” Output v o l t a g e r a n g e s from ” + string ( Vo_min ) + ”V
t o ” + string ( Vo_max ) + ”V” )

Scilab code Exa 1.13 The value of R1 and R2

1 // Exa 1 . 1 3

15
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 Rf = 250; // i n kohm
7 // Output v o l t a g e e x p r e s s i o n , Vo= −5∗Va+3∗Vb
8 // and we know t h a t f o r a d i f f e r e n c e a m p l i f i e r
circuit ,
9 // Vo= −Rf /R1∗Va + [ R2 / ( R1+R2 ) ] ∗ [ 1 + Rf /R1 ] ∗ Vb
10 // Comparing b o t h t h e e x p r e s s i o n , we g e t
11 // −Rf /R1∗Va= −5∗Va , o r
12 R1 = Rf /5; // i n kohm
13 disp ( R1 , ” The v a l u e o f R1 i n kohm” )
14 // and
15 R2 = 3* R1 ^2/( R1 + Rf -3* R1 )
16 disp ( R2 , ” The v a l u e o f R2 i n kohm” )
17
18 // Note : Answer i n t h e book i s wrong

Scilab code Exa 1.14 Output voltage

1 // Exa 1 . 1 4
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 Vi_1 = 150; // i n V
7 Vi_2 = 140; // i n V
8 Vd = Vi_1 - Vi_2 ; // i n V
9 Vd = Vd *10^ -6; // i n V
10 Vc = ( Vi_1 + Vi_2 ) /2; // i n V
11 Vc = Vc *10^ -6; // i n V
12 // Vo= Ad∗Vd∗(1+Vc / (CMRR∗Vd ) )
13
14 // ( i ) For Ad=4000 and CMRR= 100

16
15 Ad =4000;
16 CMRR = 100;
17 Vo = Ad * Vd *(1+ Vc /( CMRR * Vd ) ) ; // i n v o l t
18 disp ( Vo *10^3 , ” Output v o l t a g e i n mV” )
19
20 // ( i i ) For Ad=4000 and CMRR= 1 0 ˆ 5
21 Ad =4000;
22 CMRR = 10^5;
23 Vo = Ad * Vd *(1+ Vc /( CMRR * Vd ) ) ; // i n v o l t
24 disp ( Vo *10^3 , ” Output v o l t a g e i n mV” )

Scilab code Exa 1.15 Output voltage

1 // Exa 1 . 1 5
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 Rf =470; // i n kohm
7 R1 =4.3; // i n kohm
8 R2 =33; // i n kohm
9 R3 =33; // i n kohm
10 Vi = 80; // i n V
11 Vi = Vi *10^ -6; // i n v o l t
12 A1 = 1+ Rf / R1 ;
13 A2 = - Rf / R2 ;
14 A3 = - Rf / R3 ;
15 A = A1 * A2 * A3 ;
16 Vo = A * Vi ; // i n v o l t
17 disp ( Vo , ” Output v o l t a g e i n v o l t s i s : ” )

Scilab code Exa 1.16 Ouptut voltage

17
1 // Exa 1 . 1 6
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 R1 = 33; // i n k
7 R2 = 10; // i n k
8 R3 = 330; // i n k
9 V1 = ’ 50mV s i n ( 1 0 0 0 t ) ’ ;
10 V2 = ’ 10mV s i n ( 3 0 0 0 t ) ’ ;
11 Vo1 = R3 / R1 *50*10^ -3;
12 Vo2 = R3 / R2 *10*10^ -3;
13 // Vo= −Vo1−Vo2 ;
14 disp ( ” Output v o l t a g e i s ” + string ( - Vo1 ) + ” s i n ( 1 0 0 0 t
) ” + string ( - Vo2 ) + ” s i n ( 3 0 0 0 t ) ” )

Scilab code Exa 1.17 Output voltage

1 // Exa 1 . 1 7
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 R1 =10; // i n kohm
7 R2 =150; // i n kohm
8 R3 =10; // i n kohm
9 R4 =300; // i n kohm
10 V1 = 1; // i n V
11 V2 = 2; // i n V
12 Vo = [(1+ R4 / R2 ) *( R3 * V1 /( R1 + R3 ) ) -( R4 / R2 ) * V2 ];
13 disp ( Vo , ” Output v o l t a g e i n v o l t s i s : ” )

Scilab code Exa 1.18 Output voltage

18
1 // Exa 1 . 1 8
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 R1 =12; // i n kohm
7 Rf =360; // i n kohm
8 V1 = -0.3; // i n V
9 Vo = (1+ Rf / R1 ) * V1 ; // i n V
10 disp ( Vo , ” Output v o l t a g e r e s u l t i n v o l t s i s : ” )
11
12 // P a r t ( b )
13 Vo = 2.4; // i n V
14 // We know , Vo= (1+ Rf /R1 ) ∗V1
15 V1 = Vo /(1+ Rf / R1 ) ;
16 disp ( V1 *10^3 , ” I n p u t v o l t a g e i n mV t o r e s u l t i n an
output of 2. 4 Volt i s ”)

Scilab code Exa 1.19 Output voltage

1 // Exa 1 . 1 9
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 Rf =68; // i n kohm
7 R1 =33; // i n kohm
8 R2 =22; // i n kohm
9 R3 =12; // i n kohm
10 V1 = 0.2; // i n V
11 V2 = -0.5; // i n V
12 V3 = 0.8; // i n V
13 Vo = - Rf / R1 * V1 + ( - Rf / R2 ) * V2 + ( - Rf / R3 ) * V3 ; // i n
volts
14 disp ( Vo , ” Output v o l t a g e i n v o l t s i s : ” )

19
Scilab code Exa 1.20 Output voltage

1 // Exa 1 . 2 0
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 Rf =100; // i n kohm
7 R1 =20; // i n kohm
8 V1 = 1.5; // i n V
9 Vo1 = V1 ;
10 Vo = - Rf / R1 * Vo1 ; // i n v o l t s
11 disp ( Vo , ” Output v o l t a g e i n v o l t s i s : ” )

Scilab code Exa 1.22 Inverting op amp

1 // Exa 1 . 2 2
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 vo = -10; // i n V
7 i_f = 1; // i n mA
8 i_f = i_f *10^ -3; // i n A
9 // Formula vo= − i f ∗ Rf
10 Rf = - vo / i_f ; // i n
11 // The o u t p u t v o l t a g e , vo= −(v1 +5∗ v2 ) (i)
12 // vo= −Rf /R1∗ v1 − Rf /R2∗ v2 ; ( ii )
13 // Comparing e q u a t i o n s ( i ) and ( 2 )
14 R1 = Rf /1; // i n
15 R2 = Rf /5; // i n

20
16 disp ( Rf *10^ -3 , ” The v a l u e o f Rf i n k i s : ”)
17 disp ( R1 *10^ -3 , ” The v a l u e o f R1 i n k i s : ”)
18 disp ( R2 *10^ -3 , ” The v a l u e o f R2 i n k i s : ”)

Scilab code Exa 1.24 Output voltage

1 // Exa 1 . 2 4
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 R1 = 9; // i n k
7 R2 = 1; // i n k
8 R3 = 2; // i n k
9 R4 = 3; // i n k
10 // The o u t p u t v o l t a g e , vo1= (1+R1/R2 ) ∗ va
11 vo1BYva = (1+ R1 / R2 ) ; // (i)
12 // V o l t a g e a t node va= R4∗ v1 / ( R3+R4 )
13 vaBYv1 = R4 /( R3 + R4 ) ; // ( ii )
14 // From ( i ) and ( i i )
15 vo1BYv1 = vo1BYva * vaBYv1 ; // ( iii )
16 // The o u t p u t v o l t a g e , vo2= (1+R1/R2 ) ∗ va
17 vo2BYva = (1+ R1 / R2 ) ; // ( iv )
18 // V o l t a g e a t node va= R3∗ v2 / ( R3+R4 )
19 vaBYv2 = R3 /( R3 + R4 ) ; // (v)
20 // From ( i ) and ( i i )
21 vo2BYv2 = vo2BYva * vaBYv2 ; // ( iii )
22 // T o t a l o u t p u t vo= vo1 + vo2
23 disp ( ” T o t a l v o l t a g e i s ” + string ( vo1BYv1 ) + ” v1 + ” +
string ( vo2BYv2 ) + ” v2 ” )

Scilab code Exa 1.25 Output voltage

21
1 // Exa 1 . 2 5
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 R1 = 9; // i n k
7 R2 = 1; // i n k
8 R3 = 2; // i n k
9 R4 = 3; // i n k
10 // The o u t p u t v o l t a g e , vo1= (1+R1/R2 ) ∗ va
11 vo1BYva = (1+ R1 / R2 ) ; // (i)
12 // V o l t a g e a t node va= R4∗ v1 / ( R3+R4 )
13 vaBYv1 = R4 /( R3 + R4 ) ; // ( ii )
14 // From ( i ) and ( i i )
15 vo1BYv1 = vo1BYva * vaBYv1 ; // ( iii )
16 // The o u t p u t v o l t a g e , vo2= (1+R1/R2 ) ∗ va
17 vo2BYva = (1+ R1 / R2 ) ; // ( iv )
18 // V o l t a g e a t node va= R3∗ v2 / ( R3+R4 )
19 vaBYv2 = R3 /( R3 + R4 ) ; // (v)
20 // From ( i ) and ( i i )
21 vo2BYv2 = vo2BYva * vaBYv2 ; // ( iii )
22 // The o u t p u t v o l t a g e , vo3= (−R1/R2 ) ∗ v3
23 vo3BYv3 = ( - R1 / R2 ) ; // (i)
24
25 // T o t a l o u t p u t vo= vo1 + vo2 + vo3
26 disp ( ” T o t a l v o l t a g e i s ” + string ( vo1BYv1 ) + ” v1 + ” +
string ( vo2BYv2 ) + ” v2 ” + string ( vo3BYv3 ) + ” v3 ” )

Scilab code Exa 1.26 Gain

1 // Exa 1 . 2 6
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a

22
6 // o m e g a t= Ao∗ omega b
7 // 2∗ %pi ∗ f t = Ao∗2∗ %pi ∗ f b
8 // f t = Ao∗ f b
9 // P a r t ( i )
10 Ao1 = 10^5;
11 f_b1 = 10^2; // i n Hz
12 f_t1 = Ao1 * f_b1 ; // i n Hz
13 // P a r t ( i i )
14 Ao2 = 10^6;
15 f_t2 = 10^6; // i n Hz
16 f_b2 = f_t2 / Ao2 ; // i n Hz
17 // P a r t ( i i i )
18 f_b3 = 10^3; // i n Hz
19 f_t3 = 10^8; // i n Hz
20 Ao3 = f_t3 / f_b3 ;
21 // P a r t ( i v )
22 f_b4 = 10^ -1; // i n Hz
23 f_t4 = 10^6; // i n Hz
24 Ao4 = f_t4 / f_b4 ;
25 // P a r t ( v )
26 Ao5 = 2*10^5;
27 f_b5 = 10; // i n Hz
28 f_t5 = Ao5 * f_b5 ; // i n Hz
29 disp ( f_t1 , ” The v a l u e o f f t 1 in Hz i s : ” )
30 disp ( f_b2 , ” The v a l u e o f f b 2 in Hz i s : ” )
31 disp ( Ao3 , ” The v a l u e o f Ao3 i s : ”)
32 disp ( Ao4 , ” The v a l u e o f Ao4 i s : ”)
33 disp ( f_t5 , ” The v a l u e o f f t 5 in Hz i s : ” )

Scilab code Exa 1.27 Value of Ao fb fr

1 // Exa 1 . 2 7
2 clc ;
3 clear ;
4 close ;

23
5 // Given d a t a
6 Ao = 86; // i n dB
7 A = 40; // i n dB
8 f =100; // i n kHz
9 f = f *10^3; // i n Hz
10 // From 20∗ l o g ( S ) = 20∗ l o g ( Ao/A) , where S , s t a n d s
f o r s q r t (1+( f / f b ) ˆ 2 )
11 S = 10^(( Ao - A ) /20) ;
12 // S= s q r t (1+( f / f b ) ˆ 2 )
13 fb = f / sqrt ( S ^2 -1) ; // i n Hz
14 Ao = 10^( Ao /20) ;
15 ft = Ao * fb ; // i n Hz
16 disp ( Ao , ” The v a l u e o f Ao i s : ” )
17 disp ( fb , ” The v a l u e o f f b i n Hz i s : ” )
18 disp ( round ( ft *10^ -6) ,” The v a l u e o f f t i n MHz i s : ” )

Scilab code Exa 1.28 3dB frequency and gain

1 // Exa 1 . 2 8
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 Ao = 10^4; // i n V/V
7 f_t = 10^6; // i n Hz
8 R2byR1 = 20;
9 omega_t = 2* %pi * f_t ;
10 omega_3dB = omega_t /(1+ R2byR1 ) ;
11 f3dB = omega_3dB /(2* %pi ) ; // i n Hz
12 disp ( f3dB *10^ -3 , ”3−dB f r e q u e n c y o f t h e c l o s e d loop
a m p l i f i e r i n kHz i s : ” )
13 f3dB = 0.1* f3dB ; // i n Hz
14 voBYvi = - R2byR1 / sqrt (1+(2* %pi * f3dB / omega_3dB ) ^2) ;
15 voBYvi = abs ( voBYvi ) ; // i n v / v
16 disp ( voBYvi , ” Gain i n v / v i s : ” )

24
25
Chapter 2

MOSFET

Scilab code Exa 2.1 Device operate region

1 // Exa 2 . 1
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_S = 0; // As s o u r c e i s c o n n e c t e d t o ground
7 V_G = 1.5; // i n V
8 V_D = 0.5; // i n V
9 Vt = 0.7; // i n V
10 // P a r t ( a ) V D= 0 . 5 ; / / i n V
11 V_D = 0.5; // i n V
12 V_DS = V_D - V_S ; // i n V
13 V_GS = V_G - V_S ; // i n V
14 if V_GS < Vt then
15 disp ( ” At V D = 0 . 5 , t h e d e v i c e i s in cut o f f
r e g i o n ”)
16 elseif V_DS <= ( V_GS - Vt ) then
17 disp ( ” At V D = 0 . 5 , t h e d e v i c e i s in triode
r e g i o n ”);
18 else
19 disp ( ” At V D = 0 . 5 , t h e d e v i c e i s in saturation

26
r e g i o n ”);
20
21 end
22
23 // P a r t ( b ) V D= 0 . 9 ; / / i n V
24 V_D = 0.9; // i n V
25 V_DS = V_D - V_S ; // i n V
26 V_GS = V_G - V_S ; // i n V
27 if V_GS < Vt then
28 disp ( ” At V D = 0 . 9 , t h e d e v i c e i s in cut o f f
r e g i o n ”)
29 elseif V_DS <= ( V_GS - Vt ) then
30 disp ( ” At V D = 0 . 9 , t h e d e v i c e i s i n t r i o d e
r e g i o n ”);
31 else
32 disp ( ” At V D = 0 . 9 , t h e d e v i c e i s i n s a t u r a t i o n
r e g i o n ”);
33
34 end
35
36 // P a r t ( c ) V D= 3 ; / / i n V
37 V_D = 3; // i n V
38 V_DS = V_D - V_S ; // i n V
39 V_GS = V_G - V_S ; // i n V
40 if V_GS < Vt then
41 disp ( ” At V D = 3 , t h e d e v i c e i s in cut o f f
r e g i o n ”)
42 elseif V_DS <= ( V_GS - Vt ) then
43 disp ( ” At V D = 3 , t h e d e v i c e i s i n t r i o d e
r e g i o n ”);
44 else
45 disp ( ” At V D = 3 , t h e d e v i c e i s i n s a t u r a t i o n
r e g i o n ”);
46
47 end

27
Scilab code Exa 2.2 Drain current

1 // Exa 2 . 2
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 unCox = 100; // i n A /Vˆ2
7 unCox = unCox *10^ -6; // i n A/Vˆ2
8 L = 1; // i n m
9 L = L *10^ -6; // i n m
10 W =10; // i n m
11 W = W *10^ -6; // i n m
12 V_GS = 1.5; // i n V
13 Vt = 0.7; // i n V
14 // For V DS= 0 . 5 V
15 V_DS = 0.5; // i n V
16 if V_DS <= ( V_GS - Vt ) then
17 I_D = unCox * W / L *[( V_GS - Vt ) * V_DS - V_DS ^2/2];
18 disp ( I_D *10^6 , ” The d e v i c e i s i n t r i o d e r e g i o n .
SO t h e d r a i n c u r r e n t i n t h e t r i o d e r e g i o n i n
A i s : ”)
19 else
20 I_D = unCox * W /(2* L ) *( V_GS - VT ) ^2
21 disp ( I_D *10^6 , ” The d e v i c e i s i n s a t u r a t i o n
r e g i o n . SO t h e d r a i n c u r r e n t i n t h e
s a t u r a t i o n r e g i o n in A i s : ”)
22 end
23 // For V DS= 0 . 9 V
24 V_DS = 0.9; // i n V
25 if V_DS <= ( V_GS - Vt ) then
26 I_D = unCox * W / L *[( V_GS - Vt ) * V_DS - V_DS ^2/2];
27 disp ( I_D *10^6 , ” The d e v i c e i s i n t r i o d e r e g i o n .
So t h e d r a i n c u r r e n t i n t h e t r i o d e r e g i o n i n

28
A i s : ”)
28 else
29 I_D = unCox * W /(2* L ) *( V_GS - Vt ) ^2
30 disp ( I_D *10^6 , ” The d e v i c e i s i n s a t u r a t i o n
r e g i o n . So d r a i n c u r r e n t i n t h e s a t u r a t i o n
r e g i o n in A i s : ”)
31 end

Scilab code Exa 2.4 Value of VGS RS and RD

1 // Exa 2 . 4
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 I_D = 0.4; // i n mA
7 I_D = I_D *10^ -3; // i n A
8 Vt = 0.7; // i n V
9 V_SS = -2.5; // i n V
10 V_DD = 2.5; // i n V
11 unCox = 100; // i n A /Vˆ2
12 unCox = unCox *10^ -6; // i n A/Vˆ2
13 W = 32; // i n m
14 L = 1; // i n m
15 // V GS−Vt= V OV
16 // I D= unCox ∗W/ ( 2 ∗ L ) ∗ (V OV) ˆ2
17 V_OV = sqrt ( I_D /( unCox * W /(2* L ) ) ) ; // i n V
18 V_GS = V_OV + Vt ; // i n V
19 disp ( V_GS , ” The v a l u e o f V GS i n v o l t i s : ” )
20 V_G = 0;
21 // Formula V GS= V G−V S
22 V_S = V_G - V_GS ; // i n V
23 R_S = ( V_S - V_SS ) / I_D // i n
24 disp ( R_S *10^ -3 , ” The v a l u e o f R S i n k i s : ”)
25 V_D = 0.5; // i n V

29
26 R_D = ( V_DD - V_D ) / I_D ; // i n
27 disp ( R_D *10^ -3 , ” The v a l u e o f R D i n k i s : ”)

Scilab code Exa 2.5 Value required of R

1 // Exa 2 . 5
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_DD = 3; // i n V
7 I_D = 80; // i n A
8 I_D = I_D *10^ -6; // i n A
9 Vt = 0.6; // i n V
10 unCox = 200; // i n A /Vˆ2
11 unCox = unCox *10^ -6; // i n A/Vˆ2
12 L = 0.8; // i n m
13 L = L *10^ -6; // i n m
14 W =4; // i n m
15 W = W *10^ -6; // i n m
16 // V GS−Vt= V OV
17 // I D= unCox ∗W/ ( 2 ∗ L ) ∗ (V OV) ˆ2
18 V_OV = sqrt ( I_D /( unCox * W /(2* L ) ) ) ; // i n V
19 V_GS = V_OV + Vt ; // i n V
20 V_D = 1; // i n V
21 V_G = V_D ; // i n V
22 R = ( V_DD - V_D ) / I_D ; // i n
23 disp ( R *10^ -3 , ” The v a l u e o f R i n k i s : ”)

Scilab code Exa 2.6 Value of R and VD

1 // Exa 2 . 6
2 clc ;

30
3 clear ;
4 close ;
5 // Given d a t a
6 V_DD = 10; // i n V
7 I_D = 0.4; // i n mA
8 I_D = I_D *10^ -3; // i n A
9 Vt = 2; // i n V
10 unCox = 20; // i n A /Vˆ2
11 unCox = unCox *10^ -6; // i n A/Vˆ2
12 L = 10; // i n m
13 L = L *10^ -6; // i n m
14 W =100; // i n m
15 W = W *10^ -6; // i n m
16 V_S = 0; // i n V a s s o u r c e i s c o n n e c t e d t o g r o u n d
17 // I D= unCox ∗W/ ( 2 ∗ L ) ∗ (V OV) ˆ2
18 V_OV = sqrt ( I_D /( unCox * W /(2* L ) ) ) ; // i n V
19 V_GS = V_OV + Vt ; // i n V
20 V_D = V_GS ; // i n V
21 R = ( V_DD - V_D ) / I_D ; // i n
22 disp ( R *10^ -3 , ” The v a l u e o f R i n k i s : ”)

Scilab code Exa 2.7 Effective resistance between drain and source

1 // Exa 2 . 7
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 KnWbyL = 1; // i n mA
7 KnWbyL = KnWbyL *10^ -3; // i n A
8 Vt = 1; // i n V
9 V_DS = 0.1; // i n V
10 V_D = V_DS ; // i n V
11 V_GS = 5; // i n V
12 V_DD = V_GS ; // i n V

31
13 // Formula I D= K’nW/L ∗ [ ( V GS−Vt ) ∗V DS−V DS ˆ 2 / 2 ]
14 I_D = KnWbyL *[( V_GS - Vt ) * V_DS - V_DS ^2/2]; // i n A
15 R_D = ( V_DD - V_D ) / I_D ; // i n
16 disp ( R_D *10^ -3 , ” The r e q u i r e d v a l u e o f R D i n k is
: ”)

Scilab code Exa 2.8 Voltages at all nodes

1 // Exa 2 . 8
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 KnWbyL = 1; // i n mA/Vˆ2
7 KnWbyL = KnWbyL *10^ -3; // i n A/Vˆ2
8 Vt = 1; // i n V
9 V_DD = 10; // i n V
10 R_D = 6; // i n k
11 R_D = R_D *10^3; // i n
12 R_S = 6; // i n k
13 R_S = R_S *10^3; // i n
14 R_G1 = 10; // i n M
15 R_G1 = R_G1 *10^6; // i n
16 R_G2 = 10; // i n M
17 R_G2 = R_G2 *10^6; // i n
18 V_G = V_DD * R_G2 /( R_G1 + R_G2 ) ; // i n V
19 // V S= R S ∗ I D
20 // V GS= V G−V S= V G−R S ∗ I D
21 // Formula I D= K’nW/2∗L ∗ ( V GS−Vt ) ˆ 2 , P u t t i n g t h e
v a l u e o f V GS , We g e t
22 // 18∗ I D ˆ2 −25∗ I D +8= 0
23 // I D= 0 . 8 9 mA o r I D= 0 . 5
24 I_D = 0.5; // i n mA
25 I_D = I_D *10^ -3; // i n A
26 V_S = R_S * I_D ; // i n V

32
27 V_GS = V_G - V_S ; // i n V
28 V_D = V_DD - I_D * R_D ; // i n V
29 disp ( I_D *10^3 , ” The v a l u e o f I D i n mA i s : ” )
30 disp ( V_S , ” The v a l u e o f V S i n v o l t i s : ” )
31 disp ( V_GS , ” The v a l u e o f V GS i n v o l t i s : ” )
32 disp ( V_D , ” The v a l u e o f V D i n v o l t i s : ” )
33 disp ( ” S i n c e V D > V G − Vt , t h e t r a n s i s t o r i s
operating in saturation , a s i n i t i a l l y assumed ” )

Scilab code Exa 2.9 Value of ID and VDS

1 // Exa 2 . 9
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 R_D = 20; // i n k
7 R_D = R_D *10^3; // i n
8 R1 = 30; // i n k
9 R1 = R1 *10^3; // i n
10 R2 = 20; // i n k
11 R2 = R2 *10^3; // i n
12 V_DD = 5; // i n V
13 Vtn = 1; // i n V
14 Kn = 0.1; // i n mA/Vˆ2
15 Kn = Kn *10^ -3; // i n A/Vˆ2
16 V_GS = R2 * V_DD /( R1 + R2 ) ; // i n V
17 // I D= 1 /2 ∗ nCox ∗W/L ∗ ( V GS−Vtm) ˆ2
18 I_D = Kn *( V_GS - Vtn ) ^2 ; // i n mA ( As Kn= 1/2 ∗ nCox ∗
W/L )
19 V_DS = V_DD - I_D * R_D ; // i n V
20 disp ( V_GS , ” The v a l u e o f V GS i n v o l t i s : ” )
21 disp ( I_D *10^3 , ” The v a l u e o f I D i n mA i s : ” )
22 disp ( V_DS , ” The v a l u e o f V DS i n v o l t i s : ” )
23 disp ( ” S i n c e V DS = 3V > V DS ( s a t ) = V GS−Vtn = 2 − 1

33
V, t h e t r a n s i s t o r i s i n d e e d b i a s e d i n t h e
s a t u r a t i o n r e g i o n ”)

Scilab code Exa 2.10 Design a bias circuit

1 // Exa 2 . 1 0
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_DD = 15; // i n V
7 Vt = 1; // i n V
8 V_D = 10; // i n V
9 V_S = 5; // i n V
10 KnWbyL = 1; // i n mA/Vˆ2
11 KnWbyL = KnWbyL *10^ -3; // i n A/Vˆ2
12 R_G1 = 8; // i n M
13 R_G1 = R_G1 *10^6; // i n
14 I_D = 0.5; // i n mA
15 I_D = I_D *10^ -3; // i n A
16 R_D = ( V_DD - V_D ) / I_D ; // i n
17 R_S = V_S / I_D ; // i n
18 // Formul I D= 1 /2 ∗KnWbyL∗ (V OV) ˆ2
19 V_OV = sqrt (2* I_D / KnWbyL ) ; // i n V
20 // Formula V OV= V GS−Vt
21 V_GS = V_OV + Vt ; // i n V
22 V_G = V_GS + V_S ; // i n V
23 // Formul V G= R G2∗V DD/ ( R G1+R G2 )
24 R_G2 = R_G1 * V_G /( V_DD - V_G ) ; // i n
25 disp ( R_D *10^ -3 , ” The v a l u e o f R D i n k is : ”)
26 disp ( R_S *10^ -3 , ” The v a l u e o f R S i n k is : ”)
27 disp ( V_OV , ” The v a l u e o f V OV i n v o l t s i s : ”)
28 disp ( V_GS , ” The v a l u e o f V GS i n v o l t s i s : ”)
29 disp ( R_G2 *10^ -6 , ” The v a l u e o f R G2 i n M i s : ”)

34
Scilab code Exa 2.11 Bias point

1 // Exa 2 . 1 1
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_DD = 15; // i n V
7 KnWbyL = 0.25; // i n mA/Vˆ2
8 KnWbyL = KnWbyL *10^ -3; // i n A/Vˆ2
9 Vt = 1.5; // i n V
10 V_A = 50; // i n V
11 R_D = 10; // i n k
12 R_D = R_D *10^3; // i n
13 R_L = 10; // i n k
14 R_L = R_L *10^3; // i n
15 R_G = 10; // i n M
16 R_G = R_G *10^6; // i n
17 // I D= 1 /2 ∗KnWbyL∗ ( V D−Vt ) ˆ2 , ( V GS= V D , a s dc
gate current i s zero ) (i)
18 // V D= V DD− I D ∗R D ( ii )
19 I_D = 1.06; // i n mA
20 I_D = I_D *10^ -3; // i n A
21 V_D = V_DD - I_D * R_D ; // i n V
22 V_GS = V_D ; // i n V
23 // The c o o r d i n a t e s o f o p e r a t i n g p o i n t
24 V_GSQ = V_D ; // i n V
25 I_DQ = I_D *10^3; // i n mA
26 disp ( ” The c o o r d i n a t e s o f o p e r a t i n g p o i n t s a r e V GSQ
= ” + string ( V_GSQ ) + ” V and I DQ= ” + string ( I_DQ ) + ”
mA” )
27 gm = KnWbyL *( V_GS - Vt ) ; // i n A/V
28 r_o = V_A / I_D ; // i n
29 // The g a i n i s : Av= vo / v i = −gm∗ ( R D | | R L | | r o )

35
30 Av = - gm *[ R_D * R_L * r_o /( R_D * R_L + R_D * r_o + R_L * r_o ) ]; //
i n V/V
31 // i i = ( v i −vo ) /R G
32 // i i = v i /R G∗(1 − vo / v i ) and Rin= v i / i i = R G/(1 −Av
)
33 Rin = R_G /(1 - Av ) ; // i n
34 disp ( Rin *10^ -6 , ” The i n p u t r e s i s t a n c e i n M i s : ”)
35 disp ( ” The l a r g e s t a l l o w a b l e i n p u t s i g n a l v i i s
d e t e r m i n e d by t h e n e e d t o k e e p t h e MOSFET i n
s a t u r a t i o n at a l l times ”)
36 disp ( ” V DS >= V GS−
vt ”)
37 disp ( ”By e n f o r c i n g t h i s c o n d i t i o n w i t h e q u a l i t y a t
t h e p o i n t V GS i s maximum and V DS i s
c o r r e s p o n d i n g l y minimum” )
38 disp ( ” V DSmin=
V GSmax −Vt ” )
39 disp ( ” V DS−|Av | v i
= V GS + v i −Vt ” )
40 disp ( ” 4.4 − 3.3 vi
= 4 . 4 + v i −1.5 ” )
41 disp ( ” which r e s u l t s i n v i= 0 . 3 4V” )

Scilab code Exa 2.12 Largest value of RD

1 // Exa 2 . 1 2
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 I_D = 0.5; // i n mA
7 I_D = I_D *10^ -3; // i n mA
8 V_D = 3; // i n V
9 Vt = -1; // i n V
10 KpWbyL = 1; // i n mA/Vˆ2

36
11 KpWbyL = KpWbyL *10^ -3; // i n A/Vˆ2
12 // Formul I D= 1 /2 ∗KpWbyL∗ (V OV) ˆ2
13 V_OV = sqrt (2* I_D / KpWbyL ) ; // i n V
14 // For PMOS
15 V_OV = - V_OV ; // i n V
16 V_GS = V_OV + Vt ; // i n V
17 R_D = V_D / I_D ; // i n
18 V_Dmax = V_D + abs ( Vt ) ; // i n V
19 R_D = V_Dmax / I_D ; // i n
20 disp ( R_D *10^ -3 , ” The l a r g e s t v a l u e t h a t R D can have
w h i l e m a i n t a i n i n g s a t u r a t i o n −r e g i o n o p e r a t i o n i n
k i s : ”)

Scilab code Exa 2.14 Resistance value

1 // Exa 2 . 1 4
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_GS1 = 1.5; // i n V
7 Vt = 1; // i n V
8 r_DS1 = 1; // i n k
9 r_DS1 = r_DS1 *10^3; // i n
10 r_DS2 = 200; // i n k
11 // r DS1= 1 / (KnWbyL∗ ( V GS1−Vt ) ) (i)
12 // r DS2= 1 / (KnWbyL∗ ( V GS2−Vt ) ) (i)
13 // d i v i d i n g e q u a t i o n ( i ) by ( i i )
14 V_GS2 = ( r_DS1 / r_DS2 ) *( V_GS1 - Vt ) + Vt ; // i n V
15 disp ( V_GS2 , ”To O p t a i n rDS= 2 0 0 , The v a l u e o f V GS
s h o u l d be ( i n v o l t ) ” )
16 // For V GS= 1 . 5 ; / / V
17 // W2= 2∗W1;
18 // r DS1 / r DS2= 2
19 r_DS2 = r_DS1 /2; // i n

37
20 disp ( r_DS2 , ” For V GS= 1 . 5 V , t h e v a l u e o f r DS2 i n
i s : ”)
21 // For V GS= 3 . 5 V
22 r_DS2 = 200/2; // i n
23 disp ( r_DS2 , ” For V GS= 3 . 5 V , t h e v a l u e o f r DS2 i n
i s : ”)

Scilab code Exa 2.15 Required value of VGS and minimum value of VDS

1 // Exa 2 . 1 5
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 I_D = 0.2; // i n mA
7 I_D = I_D *10^ -3; // i n mA
8 Vt = 1; // i n V
9 KpWbyL = 0.1; // i n mA/Vˆ2
10 KpWbyL = KpWbyL *10^ -3; // i n A/Vˆ2
11 // Formul I D= 1 /2 ∗KpWbyL∗ ( V GS−VT) ˆ2
12 V_GS = sqrt (2* I_D / KpWbyL ) + Vt ; // i n V
13 V_DSmin = V_GS - Vt ; // i n V
14 disp ( V_GS , ” R e q u i r e d V GS i n v o l t s i s : ” )
15 disp ( V_DSmin , ” The minimum r e q u i r e d V DS i n v o l t s i s
: ”)
16 // For I D= 0 . 8 mA
17 I_D = 0.8*10^ -3; // i n A
18 V_GS = sqrt (2* I_D / KpWbyL ) + Vt ; // i n V
19 V_DSmin = V_GS - Vt ; // i n V
20 disp ( V_GS , ” R e q u i r e d V GS i n v o l t s i s : ” )
21 disp ( V_DSmin , ” The minimum r e q u i r e d V DS i n v o l t s i s
: ”)

38
Scilab code Exa 2.16 Value of RD and RS

1 // Exa 2 . 1 6
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_SS = -5; // i n V
7 unCox = 60; // i n A /Vˆ2
8 unCox = unCox *10^ -6; // i n A/Vˆ2
9 Vt = 1; // i n V
10 W = 100; // i n m
11 L = 3; // i n m
12 V_G =0; // i n V
13 V_DD = 5; // i n V
14 V_D =0; // i n V
15 I_D = 1*10^ -3; // i n A
16 // I D= (V DD−V D ) /R D
17 R_D = ( V_DD - V_D ) / I_D ; // i n
18 disp ( R_D *10^ -3 , ” The v a l u e o f R D i n k i s : ”)
19 // Formul I D= 1 /2 ∗ unCox ∗W/L ∗ ( V GS−Vt ) ˆ2
20 V_GS = sqrt (2* I_D * L /( unCox * W ) ) + Vt ; // i n V
21 V_S = V_G - V_GS ; // i n V
22 R_S = ( V_S - V_SS ) / I_D ; // i n
23 disp ( R_S *10^ -3 , ” The r e s i s t a n c e i n k i s ”);

Scilab code Exa 2.17 Required value of R and W

1 // Exa 2 . 1 7
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_D = 3.5; // i n V
7 I_D = 115*10^ -6; // i n A

39
8 upCox = 60; // i n A /Vˆ2
9 upCox = upCox *10^ -6; // i n A/Vˆ2
10 L = 0.8; // i n m
11 V_GS = -1.5; // i n V
12 Vt = 0.7; // i n V
13 R = V_D / I_D ; // i n
14 disp ( R *10^ -3 , ” The v a l u e r e q u i r e dfor R in k is : ”
)
15 // Formul I D= 1 /2 ∗ upCox ∗W/L ∗ ( V GS−Vt ) ˆ2
16 W = 2* I_D * L /( upCox *( V_GS - Vt ) ^2)
17 disp (W , ” The v a l u e r e q u i r e d f o r W i n m i s : ” )
18
19 // Note : Calculation of evaluating the value of W
i n t h e book i s wrong , s o t h e Answer o f t h e book
i s wrong

Scilab code Exa 2.18 Required value of gate width

1 // Exa 2 . 1 8
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 Vt = 1; // i n V
7 unCox = 120; // i n A /Vˆ2
8 unCox = unCox *10^ -6; // i n A/Vˆ2
9 L1 =1; // i n m
10 L2 = L1 ; // i n m
11 I_D = 120; // i n A
12 I_D = I_D *10^ -6; // i n A
13 V_GS1 = 1.5; // i n V
14 V_G2 = 3.5; // i n V
15 V_S2 = 1.5; // i n V
16 V_DD = 5; // i n V
17 V_D2 = 3.5; // i n V

40
18 // Formul I D= 1 /2 ∗ unCox ∗W/L ∗ ( V GS1−Vt ) ˆ2
19 W1 = 2* I_D * L1 /( unCox *( V_GS1 - Vt ) ^2) ; // i n m
20 disp ( W1 , ” The v a l u e o f W1 i n m i s : ” )
21 V_GS2 = V_G2 - V_S2 ; // i n V
22 // Formul I D= 1 /2 ∗ unCox ∗W/L ∗ ( V GS1−Vt ) ˆ2
23 W2 = 2* I_D * L2 /( unCox *( V_GS2 - Vt ) ^2) ; // i n m
24 disp ( W2 , ” The v a l u e o f W2 i n m i s : ” )
25 R = ( V_DD - V_D2 ) / I_D ; // i n
26 disp ( R *10^ -3 , ” R e s i s t a n c e i n k ” ) ;

Scilab code Exa 2.19 Value of V1 V2 V3 V4 and V5

1 // Exa 2 . 1 9
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 Vt = 2; // i n V
7 K1WbyL = 1; // i n mA/Vˆ2
8 K1WbyL = K1WbyL *10^ -3; // i n mA/Vˆ2
9 I_D = 10; // i n A
10 I_D = I_D *10^ -6; // i n A
11 V_DD = 10; // i n V
12 R_D = 4; // i n k
13 R_D = R_D *10^3; // i n
14
15 // Formul I D= 1 /2 ∗K1WbyL∗ ( V GS−Vt ) ˆ2
16 V_GS = sqrt (2* I_D / K1WbyL ) + Vt ; // i n V
17 V1 = - V_GS ; // i n V
18 // P a r t ( b )
19 I_D = 2; // i n mA
20 I_D = I_D *10^ -3; // i n A
21 V2 = V_DD - I_D * R_D ; // i n V
22 // Formul I D= 1 /2 ∗K1WbyL∗ ( V GS−Vt ) ˆ2
23 V_GS = sqrt (2* I_D / K1WbyL ) + Vt ; // i n V

41
24 V3 = - V_GS ; // i n V
25 // P a r t ( c )
26 I_D = 1; // i n mA
27 I_D = I_D *10^ -3; // i n A
28 // Formul I D= 1 /2 ∗K1WbyL∗ ( V GS−Vt ) ˆ2
29 V_GS = sqrt (2* I_D / K1WbyL ) + Vt ; // i n V
30 V4 = V_GS ; // i n V
31 // P a r t ( d )
32 I_D = 2; // i n mA
33 R_D = 2.5; // i n k
34 R_D = R_D *10^3; // i n
35 V_SS = 10; // i n V
36 I_D = I_D *10^ -3; // i n A
37 V_GS = sqrt (2* I_D / K1WbyL ) + Vt ; // i n V
38 V5 = - V_SS + I_D * R_D ; // i n V
39 disp ( V1 , ” The v a l u e o f V1 i n v o l t s i s : ”)
40 disp ( V2 , ” The v a l u e o f V2 i n v o l t s i s : ”)
41 disp ( V3 , ” The v a l u e o f V3 i n v o l t s i s : ”)
42 disp ( V4 , ” The v a l u e o f V4 i n v o l t s i s : ”)
43 disp ( V5 , ” The v a l u e o f V5 i n v o l t s i s : ”)

Scilab code Exa 2.20 Labelled current and voltage

1 // Exa 2 . 2 0
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 unCox = 20*10^ -6; // i n A/Vˆ2
7 upCox = unCox /2.5; // i n A/Vˆ2
8 V_DD = 3; // i n V
9 Vt = 1; // i n V
10 W = 30; // i n m
11 L = 10; // i n m
12

42
13
14 // V GS1= V GS2
15 // Formula V DD= V GS1+V GS2
16 V_GS1 = V_DD /2; // i n V
17 V_GS2 = V_GS1 ; // i n V
18 V2 = V_GS1 ; // inV
19 I1 = 1/2* unCox * W / L *( V_GS1 - Vt ) ^2; // i n A
20 // Both t r a n s i s t o r have V D = V G and t h e r e f o r e they
are operating in saturation
21 // 1/2 ∗ unCox ∗W/L ∗ ( V4−Vt ) ˆ2 = 1/2 ∗ upCox ∗W/L ∗ (V DD−V4−
Vt )
22 V4 = ( V_DD - Vt + sqrt ( unCox / upCox ) ) /(1+ sqrt ( unCox / upCox )
);
23 I3 = 1/2* unCox * W / L *(1.39 - Vt ) ^2
24 disp ( V2 , ” The v a l u e o f V2 i n v o l t i s : ” )
25 disp ( I1 *10^6 , ” The v a l u e o f I 1 i n Ais : ”)
26 disp ( V4 , ” The v a l u e o f V4 i n v o l t i s : ” )
27 disp ( I3 *10^6 , ” The v a l u e o f I 3 i n Ais : ”)

Scilab code Exa 2.22 Voltage gain

1 // Exa 2 . 2 2
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 Vt = 0.9; // i n V
7 V_A = 50; // i n V
8 V_D = 2; // i n V
9 R_L = 10; // i n M
10 R_L = R_L *10^3; // i n
11 R_G = 10; // i n M
12 R_G = R_G *10^6; // i n
13 I_D = 500; // i n A
14 I_D = I_D *10^ -6; // i n A

43
15 V_GS = V_D ; // i n V
16 ro = V_A / I_D ; // i n
17 gm = 2* I_D /( V_GS - Vt ) ; // i n A/V
18 // vo= −gm∗ v i ∗ ( r o | | R L )
19 vo_by_vi = - gm *( ro * R_L /( ro + R_L ) ) ; // i n V/V
20 disp ( vo_by_vi ,” The v o l t a g e g a i n i n V/V i s : ” )
21 // For I= 1 mA o r t w i c e t h e c u r r e n t
22 I_D1 = I_D ; // i n A
23 I_D2 = 2* I_D1 ; // i n A
24 gm1 = gm ; // i n A/V
25 // E f f e c t on V D
26 // I D 1 / I D 2 = ( V GS1−Vt ) ˆ 2 / ( V GS2−Vt ) ˆ2
27 V_GS1 = V_GS ;
28 V_GS2 = Vt + sqrt (2) *( V_GS1 - Vt ) ; // i n V
29 disp ( V_GS2 , ” The new v a l u e o f V GS i n v o l t s i s : ” )
30 // E f f e c t on gm
31 // gm1/gm2= s q r t ( I D 1 / I D 2 )
32 gm2 = sqrt ( I_D2 / I_D1 ) * gm1 ; // i n A/V
33 disp ( gm2 *10^3 , ” The new v a l u e o f gm2 i n mA/V i s : ” )
34 // E f f e c t on r o
35 // r o 1 / r o 2= I D 2 / I D 1
36 ro1 = ro ; // i n
37 ro2 = I_D1 * ro1 / I_D2 ; // i n
38 disp ( ro2 *10^ -3 , ” The new v a l u e o f r o i n k /V i s : ” )
39 // E f f e c t on g a i n
40 // Av= −gm∗ ( r o 2 | | R L )
41 Av = - gm *( ro2 * R_L /( ro2 + R_L ) ) ; // i n V/V
42 disp ( Av , ” The new v a l u e o f v o l t a g e g a i n i n V/V i s : ”
)
43
44 // Note : There i s some d i f f e r e n c e b e t w e e n t h e new
v a l u e o f v o l t a g e g a i n i n book and c o d i n g . The
reason behind t h i s i s that ,
45 // t h e a c c u r a t e v a l u e o f new v a l u e o f gm i s
1 . 2 8 5 6 4 8 7 and i n t h e book 1 . 3 h a s t a k e n a t p l a c e
of 1.2856487.
46 // I f we t a k e t h i s v a l u e o f new v a l u e o f gm 1 . 3 a t
p l a c e o f 1 . 2 8 5 6 4 8 7 t h e n o u r new v o l t a g e g a i n

44
v a l u e w i l l be same a s i n t h e book

Scilab code Exa 2.23 Value of CS

1 // Exa 2 . 2 3
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 I_D = 1; // i n mA
7 I_D = I_D *10^ -3; // i n A
8 gm = 1; // i n mA/V
9 gm = gm *10^ -3; // i n A/V
10 f_L = 10; // i n Hz
11 R_S = 6; // i n k
12 R_S = R_S *10^3; // i n
13 R_D = 10; // i n k
14 R_D = R_D *10^3; // i n
15 vo_by_vi = - gm * R_D /(1+ gm * R_S ) ; // i n V/V
16 disp ( vo_by_vi , ”Mid band g a i n i n V/V i s : ” ) ;
17 // Formula f L= 1 / ( 2 ∗ %pi ∗ ( 1 /gm | | R S ) ) ∗ CS
18 CS = 1/(2* %pi *(1/ gm * R_S /(1/ gm + R_S ) ) * f_L ) ; // i n F
19 disp ( CS *10^6 , ” The v a l u e o f Cs i n F i s : ” )

Scilab code Exa 2.24 Midband gain and upper 3 dB frequency

1 // Exa 2 . 2 4
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 Rsig = 100; // i n k
7 Rsig = Rsig *10^3; // i n

45
8 R_G = 4.7; // i n M
9 R_G = R_G *10^6; // i n
10 R_D = 15; // i n k
11 R_D = R_D *10^3; // i n
12 R_L = R_D ; // i n
13 gm = 1; // i n mA/V
14 gm = gm *10^ -3; // i n A/V
15 ro =150; // i n k
16 ro = ro *10^3; // i n
17 Cgs = 1; // i n pF
18 Cgs = Cgs *10^ -12; // i n F
19 Cgd = 0.4; // i n pF
20 Cgd = Cgd *10^ -12; // i n F
21 vgsBYvsig = R_G /( Rsig + R_G ) ;
22 Rdesh_L = R_D * R_L /( R_D + R_L ) ; // i n
23 voBYvgs = - gm * Rdesh_L ;
24 Av = voBYvgs / vgsBYvsig ; // i n V/V
25 disp ( Av , ” The Mid−band g a i n i n V/V i s : ” )
26 CM = Cgd *(1+ gm * Rdesh_L ) ; // i n F
27 // f H= 1 / ( 2 ∗ %pi ∗ ( R s i g | | R G ) ∗ ( Cgs ∗CM) )
28 f_H = 1/(2* %pi *( Rsig * R_G /( Rsig + R_G ) ) *( Cgs + CM ) ) ; //
i n Hz
29 disp ( f_H *10^ -3 , ” F r e q u e n c y i n kHz i s : ” )

46
Chapter 3

Bipolar Junction Transistors

Scilab code Exa 3.1 Value of IE IB IC and VC

1 // Exa 3 . 1
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_E = -0.7; // i n V
7 Bita =50;
8 RC = 5; // i n k
9 RE = 10; // i n k
10 RE = RE *10^3; // i n
11 RC = RC *10^3; // i n
12 V_CC = 10; // i n V
13 V_BE = -10; // i n v o l t
14 I_E = ( V_E - V_BE ) / RE ; // i n A
15 disp ( I_E *10^3 , ” E m i t t e r c u r r e n t i n mA i s : ” )
16 // I E= I B+I C and I C= B i t a ∗ I B , s o
17 I_B = I_E /(1+ Bita ) ; // i n A
18 disp ( I_B *10^6 , ” Base c u r r e n t i n A i s : ” )
19 I_C = I_E - I_B ; // i n A
20 disp ( I_C *10^3 , ” C o l l e c t o r c u r r e n t i n mA i s : ” )
21 V_C = V_CC - I_C * RC ; // i n V

47
22 disp ( V_C , ” The v a l u e o f V C i n v o l t s i s : ” )

Scilab code Exa 3.2 Value of alpha and bita

1 // Exa 3 . 2
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_E = 1.7; // i n V
7 V_B = 1; // i n V
8 RC = 5; // i n k
9 RE = 5; // i n k
10 RE = RE *10^3; // i n
11 RC = RC *10^3; // i n
12 RB = 100; // i n k \
13 RB = RB *10^3; // i n
14 V_CC = 10; // i n V
15 V_BE = -10; // i n v o l t
16 I_E = ( V_CC - V_E ) / RE ; // i n A
17 I_B = V_B / RB ; // i n V
18 // Formula I B= (1− a l p h a ) ∗ I E
19 alpha = 1 - I_B / I_E ;
20 disp ( alpha , ” V a l u e o f a l p h a i s : ” )
21 bita = alpha /(1 - alpha ) ;
22 disp ( bita , ” V a l u e o f b i t a i s : ” )
23 V_C = ( I_E - I_B ) * RC - V_CC ; // i n v o l t
24 disp ( V_C , ” C o l l e c t o r v o l t a g e i n v o l t s i s : ” )

Scilab code Exa 3.3 Bias voltage

1 // Exa 3 . 3
2 clc ;

48
3 clear ;
4 close ;
5 // Given d a t a
6 V_CC = 10; // i n V
7 V_CE = 3.2; // i n V
8 RC = 6.8; // i n k
9 RC = RC *10^3; // i n
10 I_S = 1*10^ -15; // i n A
11 V_T = 25*10^ -3; // i n V
12 I_C1 = ( V_CC - V_CE ) / RC ; // i n A
13 // Formula I C= I S ∗%e ˆ ( V BE1/V T )
14 V_BE1 = V_T * log ( I_C1 / I_S ) ; // i n v o l t
15 disp ( I_C1 *10^3 , ” C o l l e c t o r c u r r e n t i n mA i s : ” )
16 disp ( V_BE1 , ” V a l u e o f V BE i n v o l t s i s : ” )
17
18 // P a r t ( b )
19 v_in = 5*10^ -3; // i n V
20 Av = -( V_CC - V_CE ) / V_T ; // i n V/V
21 disp ( Av , ” V o l t a g e g a i n i n V/V i s : ” )
22 v_o = abs ( Av ) * v_in ; // i n V
23 disp ( v_o , ” Change i n o u t p u t v o l t a g e i n v o l t s i s : ” )
24
25 // P a r t ( c ) f o r V CE= 0 . 3 V
26 V_CE = 0.3; // i n V
27 I_C2 = ( V_CC - V_CE ) / RC ; // i n A
28 // I C 1= I S ∗%e ˆ ( V BE1/V T ) (i)
29 // I C 2= I S ∗%e ˆ ( V BE2/V T ) ( ii )
30 // d i v i d e t h e e q u a t i o n ( i i ) by ( i )
31 delta_V_BE = V_T * log ( I_C2 / I_C1 ) ; // i n v o l t ( where
d e l t a V B E = V BE2−V BE1 )
32 disp ( delta_V_BE *10^3 ,” The p o s i t i v e i n c r e a m e n t i n
V BE i n mV i s : ” )
33
34 // P a r t ( d )
35 v_o = 0.99* V_CC ; // i n V
36 I_C3 = ( V_CC - v_o ) / RC ; // i n A
37 delta_V_BE = V_T * log ( I_C3 / I_C1 ) ; // i n V
38 disp ( delta_V_BE *10^3 ,” The n e g a t i v e i n c r e a m e n t i n

49
V BE i n mV i s : ” )

Scilab code Exa 3.4 Design a fixed bias circuit

1 // Exa 3 . 4
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_CC = 10; // i n V
7 V_CE = 5; // i n V
8 V_BE = 0.7; // i n V
9 I_C = 5*10^ -3; // i n mA
10 bita = 100;
11 R_C = ( V_CC - V_CE ) / I_C ; // i n
12 I_B = I_C / bita ; // i n A
13 R_B = ( V_CC - V_BE ) / I_B ; // i n
14 disp ( R_C *10^ -3 , ” The v a l u e o f R C i n k i s : ”)
15 disp ( I_B *10^6 , ” The v a l u e o f I B i n A i s : ”)
16 disp ( R_B *10^ -3 , ” The v a l u e o f R B i n k i s : ”)
17
18 // Note : The v a l u e o f b a s e c u r r e n t i n t h e book i s
wrong

Scilab code Exa 3.5 Operating point

1 // Exa 3 . 5
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_CC = 6; // i n V
7 bita = 100;

50
8 R_C = 2; // i n k
9 R_C = R_C *10^3; // i n
10 R_B = 530; // i n k
11 R_B = R_B *10^3; // i n
12 // when I C =0
13 I_C =0;
14 V_CE = V_CC - I_C * R_C ; // i n v o l t
15 V_CE = 0:0.1:6; // i n V o l t
16 I_C = ( V_CC - V_CE ) / R_C *1000; // i n mA
17 plot ( V_CE , I_C ) ;
18 title ( ”DC l o a d l i n e ” )
19 xlabel ( ”V CE i n v o l t s ” )
20 ylabel ( ” I C i n mA” )
21 disp ( ”DC l o a d l i n e shown i n f i g u r e ” )
22 // When V CE= 0
23 I_C = V_CC / R_C ; // i n A
24 // O p e r a t i n g p o i n t f o r s i l i c o n t r a n s i s t o r
25 V_BE = 0.7; // i n V
26 I_B = ( V_CC - V_BE ) / R_B ; // i n A
27 I_CQ = bita * I_B ; // i n A
28 V_CEQ = V_CC - I_CQ * R_C ; // i n v o l t
29 disp ( ” O p e r a t i n g p o i n t i s ” + string ( V_CEQ ) + ” V and ” +
string ( I_CQ *10^3) + ” mA” )

Scilab code Exa 3.6 Q point values

1 // Exa 3 . 6
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_CC = 12; // i n V
7 V_BE = 0.7; // i n V
8 bita = 100;
9 R_C = 10; // i n k

51
10 R_C = R_C *10^3; // i n
11 R_B = 100; // i n k
12 R_B = R_B *10^3; // i n
13 I_BQ = ( V_CC - V_BE ) /((1+ bita ) * R_C + R_B ) ; // i n A
14 I_CQ = bita * I_BQ ; // i n A
15 V_CEQ = V_CC -( I_CQ + I_BQ ) * R_C ; // i n v o l t
16 // For dc l o a d l i n e
17 // When
18 I_C =0;
19 V_CE = V_CC -( I_C + I_BQ ) * R_C ; // i n v o l t
20 // When
21 V_CE = 0;
22 I_C = ( V_CC - I_BQ * R_C ) / R_C ; // i n A
23 disp ( ”Q− p o i n t v a l u e s f o r c i r c u i t i s ” + string ( V_CEQ )
+ ” V and ” + string ( I_CQ *10^3) + ” mA” )

Scilab code Exa 3.7 Collector to base bias circuit

1 // Exa 3 . 7
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_CC = 15; // i n V
7 V_BE = 0.7; // i n V
8 V_CE = 5; // i n V
9 I_C = 5; // i n mA
10 I_C = I_C *10^ -3; // i n A
11 bita = 100;
12 I_B = I_C / bita ; // i n A
13 disp ( I_B *10^6 , ” Base c u r r e n t i n A i s : ” )
14 // Apply KVL t o c o l l e c t o r c i r c u i t , V CC= ( I C+I B ) ∗
R C+V CE
15 R_C = ( V_CC - V_CE ) /( I_C + I_B ) ; // i n
16 disp ( R_C *10^ -3 , ” The v a l u e o f R C i n k i s : ”)

52
17 // Apply KVL t o b a s e o r i n p u t c i r c u i t , V CC= ( I C+
I B ) ∗R C+V CE + I B ∗R B
18 R_B = ( V_CC - V_BE -( I_C + I_B ) * R_C ) / I_B ; // i n ohm
19 disp ( R_B *10^ -3 , ” The v a l u e o f R B i n k i s : ”)

Scilab code Exa 3.8 Value of RB

1 // Exa 3 . 8
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_BE = 0.7; // i n V
7 V_CE = 3; // i n V
8 I_C = 1; // i n mA
9 I_C = I_C *10^ -3; // i n A
10 bita = 100;
11 I_B = I_C / bita ; // i n A
12 // V CE= V BE+V CB and V CB= I B ∗R B
13 R_B = ( V_CE - V_BE ) / I_B ; // i n
14 disp ( R_B *10^ -3 , ” The v a l u e o f R B i n k i s : ”)

Scilab code Exa 3.9 Operating point

1 // Exa 3 . 9
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 R1 = 10; // i n k
7 R1 = R1 *10^3; // i n
8 R2 = 5; // i n k
9 R2 = R2 *10^3; // i n

53
10 RC = 1; // i n k
11 RC = RC *10^3; // i n
12 RE = 2; // i n k
13 RE = RE *10^3; // i n
14 V_CC = 15; // i n V
15 V_BE = 0.7; // i n V
16 // When
17 I_C =0;
18 V_CE = V_CC - I_C *( RC + RE ) ; // i n V
19 // When V CE= 0
20 I_C = V_CC /( RC + RE ) ; // i n A
21 V_B = V_CC * R2 /( R1 + R2 ) ; // i n V
22 I_E = ( V_B - V_BE ) / RE ; // i n A
23 I_C = I_E ; // i n A ( a p p r o x )
24 I_CQ = I_C ; // i n A
25 V_CE = V_CC - I_C *( RC + RE ) ; // i n V
26 V_CEQ = V_CE ; // i n V
27 V_CE = 0:0.1:15; // i n V o l t
28 I_C = ( V_CC - V_CE ) /( RC + RE ) *1000; // i n mA
29 plot ( V_CE , I_C ) ;
30 title ( ”DC l o a d l i n e ” )
31 xlabel ( ”V CE i n v o l t s ” )
32 ylabel ( ” I C i n mA” )
33 disp ( ”DC l o a d l i n e shown i n f i g u r e ” )
34 disp ( ” O p e r a t i n g p o i n t i s ” + string ( V_CEQ ) + ” V and ” +
string ( I_CQ *10^3) + ” mA” )

Scilab code Exa 3.10 Voltage gain

1 // Exa 3 . 1 0
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_CC = 10; // i n V

54
7 V_BB = 3; // i n V
8 V_BE = 0.7; // i n V
9 V_T = 25*10^ -3; // i n V
10 bita =100;
11 RC = 3; // i n k
12 RC = RC *10^3; // i n
13 RB = 100; // i n k
14 RB = RB *10^3; // i n
15 I_B = ( V_BB - V_BE ) / RB ; // i n V
16 I_C = bita * I_B ; // i n A
17 V_C = V_CC - I_C * RC ; // i n V
18 gm = I_C / V_T ; // i n A/V
19 r_pi = bita / gm ; // i n
20 // v b e= r p i / (RB+ r p i ) ∗ v i
21 v_be_by_v_i = r_pi /( RB + r_pi ) ;
22 // v o= −gm∗ v b e ∗RC
23 v_o_by_v_i = - gm * v_be_by_v_i * RC ; // i n V/V
24 Av = v_o_by_v_i ; // i n V/V
25 disp ( round ( Av ) ,” V o l t a g e g a i n i n V/V i s : ” )

Scilab code Exa 3.11 All node voltages and currents

1 // Exa 3 . 1 1
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_B = 4; // i n V
7 V_BE = 0.7; // i n V
8 V_CC = 10; // i n V
9 V_E = V_B - V_BE ; // i n V
10 R_E = 3.3; // i n k
11 R_E = R_E *10^3; // i n
12 RC = 4.7; // i n k
13 RC = RC *10^3; // i n

55
14 I_E = V_E / R_E ; // i n A
15 bita =100;
16 alpha = bita /(1+ bita ) ;
17 I_C = alpha * I_E ; // i n A
18 disp ( I_C *10^3 , ” The v a l u e o f I C i n mA i s : ” )
19 V_C = V_CC - I_C * RC ; // i n V
20 disp ( V_C , ” The v a l u e o f V C i n v o l t s i s : ” )
21 I_B = I_E /(1+ bita ) ; // i n A
22 disp ( I_B *10^3 , ” The v a l u e o f I B i n mA i s : ” )

Scilab code Exa 3.12 All node voltage and all branch current

1 // Exa 3 . 1 2
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_B = 5; // i n V
7 V_BE = 0.7; // i n V
8 V_CC = 10; // i n V
9 bita =100;
10 R_B = 100; // i n k
11 R_C = 2; // i n k
12 R_B = R_B *10^3; // i n
13 R_C = R_C *10^3; // i n
14 I_B = ( V_B - V_BE ) / R_B ; // i n A
15 I_C = bita * I_B ; // i n A
16 V_C = V_CC - I_C * R_C ; // i n V
17 I_E = I_C ; // i n A ( a p p r o x )
18 disp ( I_B *10^3 , ” The v a l u e o f I B i n mA i s : ”)
19 disp ( I_C *10^3 , ” The v a l u e o f I C i n mA i s : ”)
20 disp ( V_C , ” The v a l u e o f V C i n volts is : ”)
21 disp ( I_E *10^3 , ” The v a l u e o f I E i n mAis : ”)

56
Scilab code Exa 3.13 All node voltage and all branch current

1 // Exa 3 . 1 3
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_B = 0; // i n V
7 V_EB = 0.7; // i n V
8 bita =100;
9 V_EC = 0.2; // i n V
10 V_E = V_EB + V_B ; // i n V
11 V_CC = 5; // i n V
12 R_C = 1; // i n k
13 R_C = R_C *10^3; // i n
14 R_B = 10; // i n k
15 R_B = R_B *10^3; // i n
16 // V E= V B+V EB (i)
17 // V C= V E−V EC= V B+V EB−V EC ( ii )
18 // I E= ( V CC−V E ) /R C= ( V CC−V B−V EB ) /R C ( iii
)
19 // I B= V B/R B ( iv )
20 // I C= ( V C+V CC ) /R C= ( V B+V EB−V EC+V CC ) /R B
(v)
21 // By u s i n g r e l a t i o n s h i p , I E= I B+I C
22 V_B = (9* V_CC -11* V_EB + V_EC ) /12; // i n V
23 V_E = V_B + V_EB ; // i n V
24 V_C = V_B + V_EB - V_EC ; // i n V
25 I_E = ( V_CC - V_B - V_EB ) / R_C // i n amp
26 I_C = ( V_B + V_EB - V_EC + V_CC ) / R_B ; // i n amp
27 I_B = V_B / R_B ; // i n amp
28 disp ( V_B , ” The v a l u e o f V B i n v o l t s i s : ” )
29 disp ( V_E , ” The v a l u e o f V E i n v o l t s i s : ” )
30 disp ( V_C , ” The v a l u e o f V C i n v o l t s i s : ” )

57
31 disp ( I_E *10^3 , ” The v a l u e o f I E i n mA i s : ” )
32 disp ( I_C *10^3 , ” The v a l u e o f I C i n mA i s : ” )
33 disp ( I_B *10^3 , ” The v a l u e o f I B i n mA i s : ” )

Scilab code Exa 3.14 Region in which Q point lie

1 // Exa 3 . 1 4
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 bita =100;
7 hFE = 100;
8 VCEsat = 0.2; // i n V
9 VBEsat = 0.8; // i n V
10 VBEactive = 0.7; // i n V
11 VBB = 5; // i n V
12 VCC = 10; // i n V
13 R_C = 3; // i n k
14 R_C = R_C *10^3; // i n
15 R_B = 50; // i n k
16 R_B = R_B *10^3; // i n
17 // Formula VCC= I C s a t ∗R C+VCEsat
18 ICsat = ( VCC - VCEsat ) / R_C ; //A
19 disp ( ICsat *10^3 , ” The v a l u e o f IC ( s a t ) i n mA i s : ” )
20 IBmin = ICsat / bita ; // i n A
21 // Apply KVL t o i n p u t c i r c u i t , VBB= IB ∗R B+VBEsat
22 IB = ( VBB - VBEsat ) / R_B ; // i n A
23 disp ( IB *10^6 , ” A c t u a l b a s e c u r r e n t i n A i s : ” )

Scilab code Exa 3.16 Value of Bita

1 // Exa 3 . 1 6

58
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 // b i t a= a l p h a /(1 − a l p h a )
7 // At a l p h a= 0 . 5
8 alpha = 0.5;
9 bita = alpha /(1 - alpha ) ;
10 disp ( bita , ” At a l p h a = 0 . 5 , t h e v a l u e o f b i t a i s : ” )
11 // At a l p h a= 0 . 9
12 alpha = 0.9;
13 bita = alpha /(1 - alpha ) ;
14 disp ( bita , ” At a l p h a = 0 . 9 , t h e v a l u e o f b i t a i s : ” )
15 // At a l p h a= 0 . 5
16 alpha = 0.999;
17 bita = alpha /(1 - alpha ) ;
18 disp ( bita , ” At a l p h a = 0 . 9 9 9 , t h e v a l u e o f b i t a i s : ” )

Scilab code Exa 3.17 Value of alpha

1 // Exa 3 . 1 7
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 // a l p h a= b i t a /(1 − b i t a )
7 // At b i t a= 1
8 bita =1;
9 alpha = bita /(1+ bita ) ;
10 disp ( alpha , ” At b i t a =1 , t h e v a l u e o f a l p h a i s : ”)
11 // At b i t a= 2
12 bita =2;
13 alpha = bita /(1+ bita ) ;
14 disp ( alpha , ” At b i t a =2 , t h e v a l u e o f a l p h a i s : ”)
15 // At b i t a= 100

59
16 bita =100;
17 alpha = bita /(1+ bita ) ;
18 disp ( alpha , ” At b i t a =100 , t h e v a l u e o f a l p h a i s : ” )
19 // At b i t a= 200
20 bita =200;
21 alpha = bita /(1+ bita ) ;
22 disp ( alpha , ” At b i t a =200 , t h e v a l u e o f a l p h a i s : ” )

Scilab code Exa 3.18 Value of Is Ic and VBE

1 // Exa 3 . 1 8
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 VBE = 0.76; // i n V
7 VT = 0.025; // i n V
8 I_C = 10*10^ -3; // i n A
9 // Formula I C= I S ∗%e ˆ (VBE/VT)
10 I_S = I_C /( %e ^( VBE / VT ) ) ; // i n A
11 disp ( I_S , ” The v a l u e o f I S i n amp i s : ” )
12 // P a r t ( a ) f o r VBE = 0 . 7 V
13 VBE = 0.7; // i n V
14 I_C = I_S * %e ^( VBE / VT )
15 disp ( I_C *10^3 , ” For VBE = 0 . 7 V , The v a l u e o f I C i n
mA i s : ” )
16
17 // P a r t ( b ) f o r I C= 10 A
18 I_C = 10*10^ -6; // i n A
19 // Formula I C= I S ∗%e ˆ (VBE/VT)
20 VBE = VT * log ( I_C / I_S ) ;
21 disp ( VBE , ” For I C = 10 A , The v a l u e o f VBE i n V i s
: ”)

60
Scilab code Exa 3.19 Transistor model

1 // Exa 3 . 1 9
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 VBE = 0.7; // i n V
7 VT = 0.025; // i n V
8 I_B = 100; // i n A
9 I_B = I_B *10^ -6; // i n A
10 I_C = 10*10^ -3; // i n A
11 // Formula I C= I S ∗%e ˆ (VBE/VT)
12 I_S = I_C /( %e ^( VBE / VT ) ) ; // i n A
13 alpha = I_C /( I_C + I_B ) ;
14 bita = I_C / I_B ;
15 IS_by_alpha = I_S / alpha ; // i n A
16 IS_by_bita = I_S / bita ; // i n A
17 disp ( alpha , ” The v a l u e o f a l p h a i s : ” ) ;
18 disp ( bita , ” The v a l u e o f b i t a i s : ” ) ;
19 disp ( IS_by_alpha , ” The v a l u e o f I s / a l p h a i n A i s : ” ) ;
20 disp ( IS_by_bita , ” The v a l u e o f I s / b i t a i n A i s : ” ) ;

Scilab code Exa 3.20 Labelled current and voltage

1 // Exa 3 . 2 0
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 VBE = 0.7; // i n V
7 VCC = 10.7; // i n V

61
8 R_C = 10; // i n k
9 R_C = R_C *10^3; // i n
10 R_B = 10; // i n k
11 R_B = R_B *10^3; // i n
12 I1 = ( VCC - VBE ) / R_C ; // i n A
13 disp ( I1 *10^3 , ” The v a l u e o f I 1 i n mA i s : ” )
14 // P a r t ( b )
15 VC = -4; // i n V
16 VB = -10; // i n V
17 R_C = 5.6; // i n k
18 R_C = R_C *10^3; // i n
19 R_B = 2.4; // i n k
20 R_B = R_B *10^3; // i n
21 VCC =12; // V
22 I_C = ( VC - VB ) / R_B ; // i n A
23 V2 = VCC - ( R_C * I_C ) ;
24 disp ( V2 , ” The v a l u e o f V2 i n v o l t i s : ” ) ;
25 // P a r t ( c )
26 VCC = 0;
27 VCE = -10; // i n V
28 R_C = 10; // i n k
29 R_C = R_C *10^3; // i n
30 I_C = ( VCC - VCE ) / R_C ; // i n A
31 V4 = 1; // i n V
32 I3 = I_C ; // i n A ( a p p r o x )
33 disp ( V4 , ” The v a l u e o f V4 i n v o l t i s : ” ) ;
34 disp ( I3 *10^3 , ” The v a l u e o f I 3 i n mA i s : ” )
35 // P a r t ( d )
36 VBE = -10; // i n V
37 VCC = 10; // i n V
38 R_B = 5; // i n k
39 R_B = R_B *10^3; // i n
40 R_C = 15; // i n k
41 R_C = R_C *10^3; // i n
42 // I 5= I C and
43 // I 5= ( V6−0.7−VBE) /R B and I C= (VCC−V6 ) /R C
44 V6 = ( VCC * R_B + R_C *(0.7+ VBE ) ) /( R_C + R_B ) ;
45 disp ( V6 , ” The v a l u e o f V6 i n v o l t i s : ” )

62
46 I5 = ( V6 -0.7 - VBE ) / R_B ; // i n A
47 disp ( I5 *10^3 , ” The v a l u e o f I 5 i n mA i s : ”)

Scilab code Exa 3.21 Value of Bita and labelled voltage

1 // Exa 3 . 2 1
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 // P a r t ( a )
7 V_C = 2; // i n V
8 R_C = 1; // i n k
9 R_C = R_C *10^3; // i n
10 V_B = 4.3; // i n V
11 R_B = 200; // i n k
12 R_B = R_B *10^3; // i n
13 I_C = V_C / R_C ; // i n A
14 I_B = V_B / R_B ; // i n A
15 bita = I_C / I_B ;
16 disp ( ” P a r t ( a ) ” )
17 disp ( I_C *10^3 , ” C o l l e c t o r c u r r e n t i n mA i s : ” )
18 disp ( I_B *10^6 , ” Base c u r r e n t i n A i s : ” )
19 disp ( bita , ” The v a l u e o f b i t a i s : ” )
20
21 // P a r t ( b )
22 V_C = 2.3; // i n V
23 R_C = 230; // i n k
24 R_C = R_C *10^3; // i n
25 V_B = 4.3; // i n V
26 R_B = 20; // i n k
27 R_B = R_B *10^3; // i n
28 I = V_C / R_C ; // c u r r e n t t h r o u g h 230 resistro i . e .
I C + I B in A
29 I_B = ( V_B - V_C ) / R_B ; // i n A

63
30 I_C = I - I_B ; // i n A
31 bita = abs ( I_C / I_B ) ;
32 disp ( ” P a r t ( b ) ” )
33 disp ( I_C *10^3 , ” C o l l e c t o r c u r r e n t i n mA i s : ” )
34 disp ( I_B *10^3 , ” Base c u r r e n t i n mA i s : ” )
35 disp ( bita , ” The v a l u e o f b i t a i s : ” )
36
37 // P a r t ( c )
38 V_E = 10; // i n V
39 R_E = 1; // i n k
40 R_E = R_E *10^3; // i n
41 V_1 = 7; // i n V
42 R_C = 1; // i n k
43 R_C = R_C *10^3; // i n
44 V_B = 6.3; // i n V
45 R_B = 100; // i n k
46 R_B = R_B *10^3; // i n
47 I_E = ( V_E - V_1 ) / R_C ; // i n A
48 I_C = I_E ; // i n A ( a p p r o x )
49 V_C = I_C * R_C ; // i n V
50 I_B = ( V_B - V_C ) / R_B ; // i n A
51 bita = I_E / I_B -1;
52 disp ( ” P a r t ( c ) ” )
53 disp ( I_E *10^3 , ” E m i t t e r c u r r e n t i n mA i s : ” )
54 disp ( I_B *10^6 , ” Base c u r r e n t i n A i s : ”)
55 disp ( V_C , ” C o l l e c t o r v o l t a g e i n v o l t s i s : ”)
56 disp ( bita , ” The v a l u e o f b i t a i s : ”)
57
58 // Note : I n t h e book t h e v a l u e o f b a s e c u r r e n t i n
t h e f i r s t p a r t i s wrong due t o c a l c u l a t i o n e r r o r .
59 // In the part ( b ) the v a l u e s o f c o l l e c t o r
c u r r e n t and b i t a a r e wrong due t o c a l c u l a t i o n
e r r o r in the f i r s t l i n e of part (b)

Scilab code Exa 3.22 The emitter base and collector voltage and current

64
1 // Exa 3 . 2 2
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 // P a r t ( a )
7 bita = 30;
8 R_C = 2.2; // i n k
9 R_C = R_C *10^3; // i n
10 R_B = 2.2; // i n k
11 R_B = R_B *10^3; // i n
12 VCC = 3; // i n V
13 VCE = -3; // i n V
14 VBE = 0.7; // i n V
15 V_B = 0; // i n V
16 V_E = V_B - VBE ; // i n V
17 I_E = ( V_E - VCE ) / R_B ; // i n A
18 I_C = I_E ; // i n A
19 V_C = VCC - I_E * R_C ; // i n V
20 I_B = I_C / bita ; // i n A
21 disp ( ” P a r t ( a ) ” )
22 disp ( V_B , ” The v a l u e o f V B in V is : ”)
23 disp ( V_E , ” The v a l u e o f V E in V is : ”)
24 disp ( I_E *10^3 , ” The v a l u e of I E in mA i s : ” )
25 disp ( V_C , ” The v a l u e o f V C in V is : ”)
26 disp ( I_B *10^3 , ” The v a l u e of I B in mA i s : ” )
27 // P a r t ( b )
28 R_C = 560; // i n
29 R_B = 1.1; // i n k
30 R_B = R_B *10^3; // i n
31 VCC = 9; // i n V
32 VCE = 3; // i n V
33 V_B = 3; // i n V
34 V_E = V_B + VBE ; // i n V
35 I_E = ( VCC - V_E ) / R_B ; // i n A
36 alpha = bita /(1+ bita ) ;
37 I_C = I_E * alpha ; // i n A
38 V_C = I_C * R_C ; // i n V

65
39 I_B = I_C / bita ; // i n A
40 disp ( ” P a r t ( b ) ” )
41 disp ( V_B , ” The v a l u e of V B in V is : ”)
42 disp ( V_E , ” The v a l u e of V E in V is : ”)
43 disp ( I_C *10^3 , ” The value of I E in mA i s : ” )
44 disp ( V_C , ” The v a l u e of V C in V is : ”)
45 disp ( I_B *10^3 , ” The value of I B in mA i s : ” )

Scilab code Exa 3.23 Value of VE VC and alpha bita

1 // Exa 3 . 2 3
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 VBE = 0.7; // i n V
7 VCC = 9; // i n V
8 VCE = -9; // i n V
9 V_B = -1.5; // i n V
10 R_C = 10; // i n k
11 R_C = R_C *10^3; // i n
12 R_B = 10; // i n k
13 R_B = R_B *10^3; // i n
14 I_B = abs ( V_B ) / R_B ; // i n A
15 V_E = V_B - VBE ; // i n V
16 disp ( V_E , ” The v a l u e o f V E i n v o l t i s : ” )
17 I_E = ( V_E - VCE ) / R_B ; // i n A
18 bita = I_E / I_B -1;
19 alpha = bita /(1+ bita ) ;
20 disp ( alpha , ” The v a l u e o f a l p h a i n v o l t i s : ” )
21 disp ( bita , ” The v a l u e o f b i t a i n v o l t i s : ” )
22 V_C = VCC - I_E * alpha * R_C ; // i n V
23 disp ( V_C , ” The v a l u e o f V C i n v o l t i s : ” )
24 // When b i t a = i n f i n i t e t h e n
25 alpha = 1 ; // As i n f i n i t e /(1+ i n f i n i t e ) = 1

66
26 I_B = 0;
27 V_B =0;
28 V_C = VCC - I_E * R_C ; // in volt
29 disp ( ”When B i t a = infinite t h e n :− ” )
30 disp ( V_B , ” The v a l u e of V B in v o l t i s : ”)
31 disp ( V_E , ” The v a l u e of V E in v o l t i s : ”)
32 disp ( V_C , ” The v a l u e of V C in v o l t i s : ”)

Scilab code Exa 3.24 Current flow

1 // Exa 3 . 2 4
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 VBE_1 = 0.7; // i n V
7 VBE_2 = 0.5; // i n V
8 V_T = 0.025; // i n V
9 I_C1 = 10; // i n mV
10 I_C1 = I_C1 *10^ -3; // i n A
11 // I C 1= I S ∗%e ˆ ( VBE 1/V T ) (i)
12 // I C 2= I S ∗%e ˆ ( VBE 2/V T ) ( ii )
13 // D e v i d e e q u a t i o n ( i i ) by ( i )
14 I_C2 = I_C1 * %e ^(( VBE_2 - VBE_1 ) / V_T ) ; // i n A
15 disp ( I_C2 *10^6 , ” The v a l u e o f I C 2 i n A is : ”)

Scilab code Exa 3.25 Voltage gain

1 // Exa 3 . 2 5
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a

67
6 R1 = 10; // i n k
7 R1 = R1 *10^3; // i n
8 R2 = 10; // i n k
9 R2 = R2 *10^3; // i n
10 I_C =.5; // mA
11 V_T = 0.025; // i n V
12 I_C = I_C *10^ -3; // i n A
13 V = 10; // i n V
14 Vth = V * R1 /( R1 + R2 ) ; // i n V
15 Rth = R1 * R2 /( R1 + R2 ) ; // i n
16 vo = I_C * Rth ; // i n V
17 vi = V_T ; // i n V
18 vo_by_vi = vo / vi ; // i n V/V
19 disp ( vo_by_vi , ” The v a l u e o f vo / v i i n V/V i s : ” )

Scilab code Exa 3.27 Value of VB VC and VE

1 // Exa 3 . 2 7
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_B = 2; // i n V
7 V_CC =5; // i n V
8 V_BE = 0.7; // i n V
9 R_E = 1*10^3; // i n
10 R_C = 1*10^3; // i n
11 V_E = V_B - V_BE ; // i n V
12 I_E = V_E / R_E ; // i n A
13 I_C = I_E ; // i n A
14 V_C = V_CC - I_C * R_C ; // i n V
15 disp ( ” At V B= +2 V” )
16 disp ( V_E , ” The v a l u e o f V E i n v o l t s i s : ” )
17 disp ( V_C , ” The v a l u e o f V C i n v o l t s i s : ” )
18

68
19 // P a r t ( b )
20 V_B = 0; // i n V
21 V_E = 0; // i n V
22 I_E = 0; // i n A
23 V_C = 5; // i n V
24 disp ( ” At V B= 0 V” )
25 disp ( V_E , ” The v a l u e o f V E i n v o l t s i s : ” )
26 disp ( V_C , ” The v a l u e o f V C i n v o l t s i s : ” )

Scilab code Exa 3.28 Value of VE and VC

1 // Exa 3 . 2 8
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_B = 0; // i n V
7 R_E =1*10^3; // i n
8 R_C =1*10^3; // i n
9 V_CC =5; // i n V
10 V_BE = 0.7; // i n V
11 V_E = V_B - V_BE ; // i n V
12 I_E = (1+ V_E ) / R_E ; // i n A
13 I_C = I_E ; // ( a p p r o x ) i n A
14 V_C = V_CC - I_C * R_C ; // i n V
15 disp ( ” P a r t ( i ) ” )
16 disp ( V_E , ” The v a l u e o f V E i n v o l t i s : ”);
17 disp ( V_C , ” The v a l u e o f V C i n v o l t i s : ”);
18 // For s a t u r a t i o n
19 V_CE =0.2 ; // V
20 V_CB = -0.5; // i n V
21 // I C= 5−V C/R C and V C= V E−VCE, So
22 // I C= (5.2 − V E ) /R C
23 // I E= ( V E+1) /R E and a t the edge o f s a t u r a t i o n
I C=I E ,

69
24 V_E = 4.2/2; // / i n V
25 V_B = V_E +0.7; // i n V
26 V_C = V_E +0.2; // i n V
27 disp ( ” P a r t ( i i ) ” )
28 disp ( V_E , ” The v a l u e o f V E i n v o l t s i s : ”);
29 disp ( V_B , ” The v a l u e o f V B i n v o l t s i s : ”);
30 disp ( V_C , ” The v a l u e o f V C i n v o l t s i s : ”);
31
32 // Note : I n t h e book , there i s a miss p r i n t in the
l a s t l i n e o f t h i s q u e s t i o n b e c a u s e V E+0.2=
2.1+0.2 = 2.3 ( n o t 2 . 8 ) , s o a n s w e r i n t h e book
i s wrong

Scilab code Exa 3.29 Value of VB IB IE IC VC alpha and bita

1 // Exa 3 . 2 9
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_CC =5; // i n V
7 V_E = 1; // i n V
8 V_BE = 0.7; // i n V
9 R_E =5*10^3; // i n
10 R_C =5*10^3; // i n
11 R_B = 20*10^3; // i n
12 I_E = ( V_CC - V_E ) / R_E ; // i n A
13 // For pnp t r a n s i s t o r V BE= V E−V B
14 V_B = V_E - V_BE ; // i n V
15 I_B = V_B / R_B ; // i n A
16 I_C = I_E - I_B ; // i n A
17 V_C = I_C * R_C - V_CC ; // i n V
18 bita = I_C / I_B ;
19 alpha = I_C / I_E ;
20 disp ( V_B , ” The v a l u e o f V B i n v o l t s i s : ” ) ;

70
21 disp ( I_B *10^3 , ” The v a l u e o f I B i n mA i s : ”);
22 disp ( I_E *10^3 , ” The v a l u e o f I E i n mA i s : ”);
23 disp ( I_C *10^3 , ” The v a l u e o f I C i n mA i s : ”);
24 disp ( V_C , ” The v a l u e o f V C i n v o l t s i s : ”);
25 disp ( bita , ” The v a l u e o f b i t a i s : ” ) ;
26 disp ( alpha , ” The v a l u e o f a l p h a i s : ” ) ;

Scilab code Exa 3.30 DC voltage and value of gm

1 // Exa 3 . 3 0
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_CC =5; // i n V
7 V_T = 0.025; // i n V
8 R_C =7.5*10^3; // i n
9 I_C = 0.5; // i n mA
10 I_C = I_C *10^ -3; // i n A
11 I_E = I_C ; // ( a p p r o x ) i n A
12 V_C = V_CC - I_C * R_C ; // i n V
13 disp ( V_C , ” dc v o l t a g e a t t h e c o l l e c t o r i n v o l t i s : ”
)
14 gm = I_C / V_T ; // i n A/V
15 disp ( gm *10^3 , ” The v a l u e o f gm i n mA/V i s : ” )
16 // v b e= − v i
17 // v c= −gm∗ v b e ∗R C
18 vcbyvi = gm * R_C ; // i n V/V
19 disp ( vcbyvi , ” The v a l u e o f vc / v i i n V/V i s : ” )

Scilab code Exa 3.31 Input resistance and overall voltage gain

1 // Exa 3 . 3 1

71
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_T = 0.025; // i n V
7 I_E = 0.5; // i n mA
8 I_E = I_E *10^ -3; // i n mA
9 Rsig = 50; // i n
10 R_C = 5*10^3; // i n
11 re = V_T / I_E ; // i n ohm
12 Rin = Rsig + re ; // i n ohm
13 disp ( Rin , ” I n p u t r e s i s t a n c e i n i s : ”)
14 // P a r t ( b )
15 // vo= −0.99∗ i e ∗R C and i e = − v s i g / Rin
16 vo_by_v_sig = 0.99* R_C / Rin ; // i n V/V
17 disp ( vo_by_v_sig , ” The v a l u e o f vo / v s i g i n V/V i s : ”
)

Scilab code Exa 3.32 Input resistance and overall voltage gain

1 // Exa 3 . 3 2
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 bita = 200;
7 alpha = bita /(1+ bita ) ;
8 R_C = 100; // i n
9 R_B = 10; // i n k
10 Rsig = 1; // i n k
11 Rsig = Rsig *10^3; // i n
12 R_B = R_B *10^3; // i n
13 V_T = 25*10^ -3;
14 V =1.5; // i n V
15 I_E = 10; // i n mA

72
16 I_E = I_E *10^ -3; // i n A
17 I_C = alpha * I_E ; // i n A
18 V_C = I_C * R_C ; // i n V
19 I_B = I_C / bita ; // i n A
20 V_B = V -( R_B * I_B )
21 gm = I_C / V_T ; // i n A/V
22 rpi = bita / gm ; // i n
23 Rib = rpi ; // i n
24 disp ( Rib , ” The v a l u e o f Rib i n i s : ”)
25 Rin = R_B * rpi /( R_B + rpi ) ; // i n
26 disp ( Rin , ” The v a l u e o f Rin i n i s : ”)
27 // vbe= v s i g ∗ Rin / ( R s i g+Rin ) ;
28 vbe_by_vsig = Rin /( Rsig + Rin ) ;
29 // vo= −gm∗ vbe ∗R C and = −gm∗ v s i g ∗ Rin / ( R s i g+Rin )
30 vo_by_vsig = - gm * R_C * vbe_by_vsig ; // i n V/V
31 disp ( vo_by_vsig , ” O v e r a l l v o l t a g e g a i n i n V/V i s : ” )
32 // i f
33 vo = 0.4; // ( ) i n V
34 vs = vo / abs ( vo_by_vsig ) ; // i n V
35 vbe = vbe_by_vsig * vs ; // i n V
36 disp ( vs *10^3 , ” The v a l u e o f v s i g i n mV i s : ” )
37 disp ( vbe *10^3 , ” The v a l u e o f v b e i n mV i s : ” )
38
39 // Note : There i s some d i f f e r e n c e b e t w e e n i n t h i s
c o d i n g and book s o l u t i o n . But Coding i s c o r r e c t .

Scilab code Exa 3.33 Value of alpha bita and Is

1 // Exa 3 . 3 3
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_T = 0.025; // i n V
7 // P a r t ( a )

73
8 disp ( ” P a r t ( a ) ” )
9 V_BE = 690; // i n mV
10 V_BE = V_BE *10^ -3; // i n V
11 I_C = 1; // i n mA
12 I_B = 50; // i n A
13 I_C = I_C *10^ -3; // i n A
14 I_B = I_B *10^ -6; // i n A
15 bita = I_C / I_B ;
16 alpha = bita /(1+ bita ) ;
17 I_E = I_C / alpha ; // i n A
18 // I C= I S ∗%e ˆ ( V BE/V T )
19 I_S = I_C /( %e ^( V_BE / V_T ) ) ;
20 disp ( bita , ” The v a l u e o f b i t a i s : ” )
21 disp ( alpha , ” The v a l u e o f a l p h a i s : ” )
22 disp ( I_E *10^3 , ” The v a l u e o f I E i n mA i s : ” )
23 disp ( I_S , ” The v a l u e o f I S i n amp i s : ” )
24
25 // P a r t ( b )
26 disp ( ” P a r t ( b ) ” )
27 V_BE = 690; // i n mV
28 V_BE = V_BE *10^ -3; // i n V
29 I_C = 1; // i n mA
30 I_C = I_C *10^ -3; // i n A
31 I_E = 1.070; // i n mA
32 I_E = I_E *10^ -3; // i n A
33 bita = I_C / I_B ;
34 alpha = I_C / I_E ;
35 bita = alpha /(1 - alpha ) ;
36 I_B = I_C / bita ; // i n A
37 // I C= I S ∗%e ˆ ( V BE/V T )
38 I_S = I_C /( %e ^( V_BE / V_T ) ) ;
39 disp ( bita , ” The v a l u e o f b i t a i s : ” )
40 disp ( alpha , ” The v a l u e o f a l p h a i s : ” )
41 disp ( I_B *10^6 , ” The v a l u e o f I B i n A i s : ” )
42 disp ( I_S , ” The v a l u e o f I S i n amp i s : ” )
43
44 // P a r t ( c )
45 disp ( ” P a r t (C) ” )

74
46 V_BE = 580; // i n mV
47 V_BE = V_BE *10^ -3; // i n V
48 I_E = 0.137; // i n mA
49 I_B = 7; // i n A
50 I_E = I_E *10^ -3; // i n A
51 I_B = I_B *10^ -6; // i n A
52 // I C= a l p h a ∗ I E = b i t a ∗ I B
53 bita = I_E / I_B -1;
54 alpha = bita /(1+ bita ) ;
55 I_C = bita * I_B ; // i n A
56 // I C= I S ∗%e ˆ ( V BE/V T )
57 I_S = I_C /( %e ^( V_BE / V_T ) ) ;
58 disp ( bita , ” The v a l u e o f b i t a i s : ” )
59 disp ( alpha , ” The v a l u e o f a l p h a i s : ” )
60 disp ( I_C *10^3 , ” The v a l u e o f I C i n mA i s : ” )
61 disp ( I_S , ” The v a l u e o f I S i n amp i s : ” )
62
63 // P a r t ( d )
64 disp ( ” P a r t ( d ) ” )
65 V_BE = 780; // i n mV
66 V_BE = V_BE *10^ -3; // i n V
67 I_C = 10.10; // i n mA
68 I_B = 120; // i n A
69 I_C = I_C *10^ -3; // i n A
70 I_B = I_B *10^ -6; // i n A
71 bita = I_C / I_B ;
72 alpha = bita /(1+ bita ) ;
73 I_E = I_C / alpha ; // i n A
74 // I C= I S ∗%e ˆ ( V BE/V T )
75 I_S = I_C /( %e ^( V_BE / V_T ) ) ;
76 disp ( bita , ” The v a l u e o f b i t a i s : ” )
77 disp ( alpha , ” The v a l u e o f a l p h a i s : ” )
78 disp ( I_E *10^3 , ” The v a l u e o f I E i n mA i s : ” )
79 disp ( I_S , ” The v a l u e o f I S i n amp i s : ” )
80
81 // P a r t ( e )
82 disp ( ” P a r t ( e ) ” )
83 V_BE = 820; // i n mV

75
84 V_BE = V_BE *10^ -3; // i n V
85 I_E = 75; // i n mA
86 I_B = 1050; // i n A
87 I_E = I_E *10^ -3; // i n A
88 I_B = I_B *10^ -6; // i n A
89 // I C= a l p h a ∗ I E = b i t a ∗ I B
90 bita = I_E / I_B -1;
91 alpha = bita /(1+ bita ) ;
92 I_C = bita * I_B ; // i n A
93 // I C= I S ∗%e ˆ ( V BE/V T )
94 I_S = I_C /( %e ^( V_BE / V_T ) ) ;
95 disp ( bita , ” The v a l u e o f b i t a i s : ” )
96 disp ( alpha , ” The v a l u e o f a l p h a i s : ” )
97 disp ( I_C *10^3 , ” The v a l u e o f I C i n mA i s : ” )
98 disp ( I_S , ” The v a l u e o f I S i n amp i s : ” )

76
Chapter 4

Differential Amplifiers

Scilab code Exa 4.1 Value of ic1 and vce1

1 // Exa 4 . 1
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_CC = 10; // i n v o l t
7 V_EE = -10; // i n v o l t
8 I = 1; // i n mA
9 I = I *10^ -3; // i n A
10 R_C = 10; // i n kohm
11 R_C = R_C *10^3; // i n kohm
12 V_BE =0.7; // i n v o l t
13
14 i_C1 = I /2; // i n A
15 i_C2 = i_C1 ; // i n A
16 disp ( i_C1 *10^3 , ” V a l u e o f i C 1 i n mA i s : ” )
17
18 V_C1 = V_CC - i_C1 * R_C ; // i n V
19 // For V cm=0 v o l t
20 V_E = -0.7; // i n v o l t
21 V_CE1 = V_C1 - V_E ; // i n v o l t

77
22 disp ( V_CE1 , ” For V cm =0 , The a l u e o f V CE1 i n v o l t
i s ”)
23
24 // For V cm= −5 v o l t
25 V_cm = -5; // i n V
26 V_B = V_cm ; // i n V
27 // From V BE= V B−V E
28 V_E = V_B - V_BE ; // i n v o l t
29 V_CE1 = V_C1 - V_E ; // i n v o l t
30 disp ( V_CE1 , ” For V cm =−5V , The a l u e o f V CE1 i n
v o l t i s ”)
31
32 // For V cm= 5 v o l t
33 V_cm = 5; // i n V
34 V_B = V_cm ; // i n V
35 V_E = V_B - V_BE ; // i n v o l t
36 V_CE1 = V_C1 - V_E ; // i n v o l t
37 disp ( V_CE1 , ” For V cm =5V , The a l u e o f V CE1 i n volt
i s ”)

Scilab code Exa 4.2 Value of VOV and VGS

1 // Exa 4 . 2
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_DD = 1.5; // i n V
7 V_SS = V_DD ; // i n V
8 KnWL = 4; // i n mA/Vˆ2
9 KnWL = KnWL *10^ -3; // i n A/Vˆ2
10 Vt = 0.5; // i n V
11 I =0.4; // i n mA
12 I = I *10^ -3; // i n A
13 R_D = 2.5; // i n k

78
14 R_D = R_D *10^3; // i n
15
16 // P a r t ( a )
17 disp ( ” P a r t ( a ) ” )
18 V_OV = sqrt ( I / KnWL ) ; // i n V
19 V_GS = V_OV + Vt ; // i n V
20 disp ( V_OV , ” V a l u e o f V OV i n v o l t i s : ” )
21 disp ( V_GS , ” V a l u e o f V GS i n v o l t i s : ” )
22
23 // P a r t ( b )
24 disp ( ” P a r t ( b ) ” )
25 V_CM = 0; // i n v o l t
26 V_S = - V_GS ; // i n v o l t
27 disp ( V_S , ” V a l u e o f V S i n v o l t i s : ”)
28 I =0.4; // i n mA
29 i_D1 = I /2; // i n mA
30 disp ( i_D1 , ” V a l u e o f i D 1 i n mA i s : ”)
31 i_D1 = i_D1 *10^ -3; // i n A
32 V_D1 = V_DD - i_D1 * R_D ; // i n V
33 V_D2 = V_D1 ; // i n V
34 disp ( V_D1 , ” V a l u e o f V D1 i n v o l t i s ”)
35 disp ( V_D2 , ” V a l u e o f V D2 i n v o l t i s ”)
36
37
38 // P a r t ( c )
39 disp ( ” P a r t ( c ) ” )
40 V_CM =1; // i n V
41 V_GS = 0.82; // i n V
42 V_G = 1; // i n V
43 V_S = V_G - V_GS ; // i n V
44 disp ( V_S , ” V a l u e o f V S i n v o l t i s : ”)
45 i_D1 = I /2; // i n mA
46 disp ( i_D1 , ” V a l u e o f i D 1 i n mA i s : ”)
47 i_D1 = i_D1 *10^ -3; // i n A
48 V_D1 = V_DD - i_D1 * R_D ; // i n V
49 V_D2 = V_D1 ; // i n V
50 disp ( V_D1 , ” V a l u e o f V D1 i n v o l t i s ”)
51 disp ( V_D2 , ” V a l u e o f V D2 i n v o l t i s ”)

79
52
53 // P a r t ( d )
54 disp ( ” P a r t ( d ) ” )
55 V_CM_max = Vt + V_DD - i_D1 * R_D
56 disp ( V_CM_max , ” H i g h e s t v a l u e o f V CM i n v o l t i s : ” )
57
58 // P a r t ( e )
59 V_S = 0.4; // i n V
60 disp ( ” P a r t ( e ) ” )
61 V_CM_min = - V_SS + V_S + Vt + V_OV ; // i n V
62 disp ( V_CM_min , ” Lowest v a l u e o f V CM i n v o l t i s ” )
63 V_Smin = V_CM_min - V_GS ; // i n v o l t
64 disp ( V_Smin , ” Lowest v a l u e o f V S i n v o l t i s ” )

Scilab code Exa 4.3 Required values of WbyL

1 // Exa 4 . 3
2 clc ;
3 clear ;
4 close ;
5 format ( ’ v ’ ,5)
6 // Given d a t a
7 I = 0.4; // i n mA
8 unCox = 0.2; // i n mA/Vˆ2
9 i_D = I /2; // i n mA
10 V_OV1 = 0.2; // i n V
11 V_OV2 = 0.3; // i n V
12 V_OV3 = 0.4; // i n V
13 WbyL1 = 2* i_D /( unCox * V_OV1 ^2) ;
14 gm1 = I / V_OV1 ; // i n mA/V
15 WbyL2 = 2* i_D /( unCox * V_OV2 ^2) ;
16 gm2 = I / V_OV2 ; // i n mA/V
17 WbyL3 = 2* i_D /( unCox * V_OV3 ^2) ;
18 gm3 = I / V_OV3 ; // i n mA/V
19 disp ( ”Vov ( i n V) ” + string ( V_OV1 ) + ”

80
” + string ( V_OV2 ) + ” ” + string (
V_OV3 ) )
20 disp ( ”W/L ” + string ( WbyL1 ) + ”
” + string ( WbyL2 ) + ” ” + string (
WbyL3 ) )
21 disp ( ”gm( i n mA/V) ” + string ( gm1 ) + ” ”
+ string ( gm2 ) + ” ” + string ( gm3 ) )

Scilab code Exa 4.4 Value of VOV gm ro and Ad

1 // Exa 4 . 4
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 format ( ’ v ’ ,11)
7 V_A = 20; // i n V
8 R_D = 5; // i n k
9 R_D = R_D *10^3; // i n
10 I = 0.8; // i n mA
11 I = I *10^ -3; // i n A
12 i_D = I /2; // i n A
13 unCox = 0.2; // mA/Vˆ2
14 unCox = unCox *10^ -3; // i n A/Vˆ2
15 WbyL = 100;
16 // Formula i D= 1/2 ∗ unCox ∗WbyL∗V OVˆ2
17 V_OV = sqrt (2* i_D /( unCox * WbyL ) ) ; // i n V
18 disp ( V_OV , ” The v a l u e o f V OV i n v o l t s i s : ” )
19 gm = I / V_OV ; // i n A/V ;
20 disp ( gm *10^3 , ” The v a l u e o f gm i n mA/V i s : ” )
21 r_o = V_A / i_D ; // i n
22 disp ( r_o *10^ -3 , ” The v a l u e o f r o i n k i s : ”)
23 // Ad= v o / v i d = gm∗ ( R D | | r o )
24 Ad = gm *( R_D * r_o /( R_D + r_o ) ) ; // i n V/V
25 disp ( Ad , ” D i f f e r e n t i a l g a i n i n V/V i s : ” )

81
Scilab code Exa 4.5 Differential gain

1 // Exa 4 . 5
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 R_D = 5; // i n k
7 R_D = R_D *10^3; // i n
8 R_SS = 25; // i n k
9 R_SS = R_SS *10^3; // i n
10 I = 0.8; // i n mA
11 I = I *10^ -3; // i n A
12 i_D = I /2; // i n A
13 unCox = 0.2; // mA/Vˆ2
14 unCox = unCox *10^ -3; // i n A/Vˆ2
15 WbyL = 100;
16 // Formula i D= 1/2 ∗ unCox ∗WbyL∗V OVˆ2
17 V_OV = sqrt (2* i_D /( unCox * WbyL ) ) ; // i n V
18 gm = i_D / V_OV ; // i n A/V ;
19
20 // P a r t ( a )
21 Ad = 1/2* gm * R_D ; // i n V/V
22 disp ( Ad , ” D i f f e r e n t i a l g a i n i n V/V i s : ” )
23 Acm = - R_D /(2* R_SS ) ; // i n V/V
24 disp ( Acm , ”Common mode g a i n i n V/V i s ” )
25 CMRR = abs ( Ad ) / abs ( Acm ) ;
26 CMRRindB = round (20* log10 ( CMRR ) ) ; // i n dB
27 disp ( CMRRindB , ”Common mode r e j e c t i o n r a t i o i n dB i s
: ”)
28
29
30 // P a r t ( b )
31 disp ( ” P a r t ( b ) when o u t p u t i s t a k e n d i f f e r e n t i a l l y ” )

82
32 Ad = gm * R_D ; // i n V/V
33 disp ( Ad , ” D i f f e r e n t i a l g a i n i n V/V i s : ” )
34 Acm = 0;
35 disp ( Acm , ”Common mode g a i n i n V/V i s ” )
36 // CMRRindB= 20∗ l o g 1 0 ( Ad/Acm) = i n f i n i t e ; / / i n dB
37 disp ( ”Common mode r e j e c t i o n r a t i o i n dB i s : ” )
38 disp ( ” i n f i n i t e ” ) ;
39
40 // P a r t ( c )
41 disp ( ” P a r t ( c ) when o u t p u t i s t a k e n d i f f e r e n t i a l l y
but t h e d r a i n r e s i s t a n c e have a 1% mismatch . ” )
42 Ad = gm * R_D ; // i n V/V
43 disp ( Ad , ” D i f f e r e n t i a l g a i n i n V/V i s : ” )
44 // d e l t a R D= 1% o f R D
45 delta_R_D = R_D *1/100; // i n
46 Acm = R_D /(2* R_SS ) * delta_R_D / R_D ; // i n V/V
47 disp ( Acm , ”Common mode g a i n i n V/V i s ” )
48 CMRRindB = 20* log10 ( abs ( Ad ) / abs ( Acm ) ) ; // i n dB
49 disp ( CMRRindB , ”Common mode r e j e c t i o n r a t i o i n dB i s
: ”)
50
51 // Note : I n t h e book , t h e r e i s p u t t i n g wrong v a l u e
o f Ad ( 2 0 a t p l a c e o f 1 0 ) t o e v a l u a t e t h e v a l u e
o f CMRR i n dB i n p a r t ( c ) , So t h e a n s w e r o f CMRR
i n dB o f P a r t ( c ) i s wrong

Scilab code Exa 4.6 CMRR

1 // Exa 4 . 6
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a ( From Exa 4 . 4 )
6 R_D = 5; // i n k
7 R_D = R_D *10^3; // i n

83
8 R_SS = 25; // i n k
9 R_SS = R_SS *10^3; // i n
10 I = 0.8; // i n mA
11 I = I *10^ -3; // i n A
12 i_D = I /2; // i n A
13 unCox = 0.2; // mA/Vˆ2
14 unCox = unCox *10^ -3; // i n A/Vˆ2
15 WbyL = 100;
16 // Formula i D= 1/2 ∗ unCox ∗WbyL∗V OVˆ2
17 V_OV = sqrt (2* i_D /( unCox * WbyL ) ) ; // i n V
18 gm = i_D / V_OV ; // i n A/V ;
19 // gm mismatch have a n e g l i g i b l e e f f e c t on Ad
20 Ad = gm * R_D ; // i n V/V( a p p r o x )
21 // d e l t a g m= 1% o f gm
22 delta_gm = gm *1/100; // i n A/V
23 Acm = R_D /(2* R_SS ) * delta_gm / gm ;
24 CMRRindB = 20* log10 ( Ad / Acm ) ;
25 disp ( CMRRindB , ”CMRR i n dB i s : ” )

Scilab code Exa 4.7 Value of VE VC1 and VC2

1 // Exa 4 . 7
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_CM = 0;
7 V_BE = -0.7; // i n v o l t
8 v_E = V_CM - V_BE ; // i n v o l t
9 disp ( v_E , ” V a l u e o f v E i n v o l t s i s : ”)
10
11 I_E = (5 -0.7) /10^3; // i n A
12 v_B1 = 0.5; // i n V
13 v_B2 = 0; // i n V
14 // Due t o Q1 i s o f f ; t h e r e f o r e

84
15 v_C1 = -5; // i n V
16 v_C2 = I_E *10^3 -5; // i n V
17 disp ( v_C1 , ” V a l u e o f v C1 i n v o l t s i s : ” )
18 disp ( v_C2 , ” V a l u e o f v C2 i n v o l t s i s : ” )

Scilab code Exa 4.8 Input differential signal

1 // Exa 4 . 8
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 iE1_by_I = 0.99; // a s i t i s g i v e n t h a t i E 1= 0 . 9 9 ∗ I
7 VT = 0.025; // i n v o l t
8 // Formula i E 1= I /(1+%eˆ(− v i d /VT) )
9 // %eˆ(− v i d /VT)= 1/ i E 1 b y I −1
10 vid = log ( 1/ iE1_by_I -1) *( - VT ) ; // i n v o l t
11 disp ( round ( vid *10^3) ,” I n p u t d i f f e r e n t i a l s i g n a l i n
mVis : ” )

Scilab code Exa 4.9 Input differential resistance

1 // Exa 4 . 9
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 Bita = 100;
7
8 // P a r t ( a )
9 RE = 150; // i n
10 VT = 25; // i n mV
11 VT = VT *10^ -3; // i n V

85
12 IE = 0.5; // i n mA
13 IE = IE *10^ -3; // i n A
14 re1 = VT / IE ; // i n
15 R_id = 2*( Bita +1) *( re1 + RE ) ; // i n
16 R_id = round ( R_id *10^ -3) ; // i n k
17 disp ( R_id , ” The i n p u t d i f f e r e n t i a l r e s i s t a n c e in k
i s : ”)
18
19 // P a r t ( b )
20 RC =10; // i n k
21 RC = RC *10^3; // i n
22 Rsig = 5+5; // i n k
23 VoltageGain1 = R_id /( Rsig + R_id ) ; // v o l t a g e g a i n from
t h e s i g n a l s o u r c e t o t h e b a s e o f Q1 and Q2 i n V/V
24 VoltageGain2 = 2* RC /(2*( re1 + RE ) ) ; // v o l t a g e g a i n from
t h e b a s e s t o t h e o u t p u t i n V/V
25 Ad = VoltageGain1 * VoltageGain2 ; // i n V/V
26 disp ( Ad , ” The o v e r a l l d i f f e r e n t i a l v o l t a g e g a i n i n V/
V i s ”);
27
28 // P a r t ( c )
29 delta_RC = 0.02* RC ;
30 R_EE = 200; // i n k
31 R_EE = R_EE *10^3; // i n
32 Acm = RC /(2* R_EE ) * delta_RC / RC ; // i n V/V
33 disp ( Acm , ”Common mode g a i n i n V/V i s : ” )
34
35 // P a r t ( d )
36 CMRRindB = 20* log10 ( Ad / Acm ) ; // i n dB
37 disp ( CMRRindB , ”CMRR i n dB i s : ” )
38
39 // P a r t ( e )
40 V_A = 100; // i n V
41 r_o = V_A /( IE ) ; // i n
42 // Ricm= ( B i t a +1) ∗ ( R EE | | r o / 2 )
43 Ricm = ( Bita +1) *( R_EE *( r_o /2) /( R_EE +( r_o /2) ) ) ;
44 disp ( Ricm *10^ -6 , ” I n p u t common mode r e s i s t a n c e i n M
i s : ”)

86
Scilab code Exa 4.10 Three components of input offset voltage

1 // Exa 4 . 1 0
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 delta_RDbyRD = 2/100;
7 delta_WLbyWL = 2/100;
8 delta_Vt = 2; // i n mV
9 delta_Vt = delta_Vt *10^ -3; // i n V
10 // ( From Exa 4 . 4 )
11 V_A = 20; // i n V
12 R_D = 5; // i n k
13 R_D = R_D *10^3; // i n
14 I = 0.8; // i n mA
15 I = I *10^ -3; // i n A
16 i_D = I /2; // i n A
17 unCox = 0.2; // mA/Vˆ2
18 unCox = unCox *10^ -3; // i n A/Vˆ2
19 WbyL = 100;
20 // Formula i D= 1/2 ∗ unCox ∗WbyL∗V OVˆ2
21 V_OV = sqrt (2* i_D /( unCox * WbyL ) ) ; // i n V
22 V_OS1 = V_OV /2* delta_RDbyRD ; // i n V
23
24 // V OS due t o W/L r a t i o
25 V_OS2 = V_OV /2* delta_WLbyWL ; // i n V
26
27 // V OS due t o t h r e s h o l d v o l t a g e
28 V_OS3 = delta_Vt ; // i n V
29 // T o t a l o f f s e t v o l t a g e
30 V_OS = sqrt ( V_OS1 ^2+ V_OS2 ^2+ V_OS3 ^2) ; // i n V
31 V_OS = V_OS *10^3; // i n mV
32 disp ( V_OS , ” T o t a l o f f s e t v o l t a g e i n mV i s : ” )

87
Scilab code Exa 4.11 Value of Gm Ro Ad Acm and CMRR

1 // Exa 4 . 1 1
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 WLn = 100;
7 WLp = 200;
8 unCox = 0.2; // mA/Vˆ2
9 unCox = unCox *10^ -3; // i n A/Vˆ2
10 RSS = 25; // i n k
11 RSS = RSS *10^3; // i n
12 I =0.8; // i n mA
13 I = I *10^ -3; // i n A
14 V_A = 20; // i n V
15 i_D = I /2; // i n A
16 // Formula i D= 1/2 ∗ unCox ∗WLn∗V OVˆ2
17 V_OV = sqrt (2* i_D /( unCox * WLn ) ) ; // i n V
18 gm = I / V_OV ; // i n A/V
19 disp ( gm *10^3 , ” V a l u e o f Gm i n mA/V i s : ” )
20 ro2 = V_A /( I /2) ; // i n ohm
21 ro4 = ro2 ; // i n ohm
22 Ro = ro2 * ro4 /( ro2 + ro4 ) ; // i n ohm
23 disp ( Ro *10^ -3 , ” V a l u e o f Ro i n k i s : ”)
24 Ad = gm * Ro ; // i n V/V
25 disp ( Ad , ” V a l u e o f Ad i n V/V i s : ” )
26 // F i n d i n g t h e v a l u e o f gm3
27 upCox = 0.1; // mA/Vˆ2
28 upCox = upCox *10^ -3; // i n A/Vˆ2
29 // Formula i D= 1/2 ∗ upCox ∗WLp∗V OVˆ2
30 V_OV = sqrt (2* i_D /( upCox * WLp ) ) ; // i n V
31 gm3 = I / V_OV ; // i n A/V
32 Acm = 1/(2* gm3 * RSS ) ; // i n V/V

88
33 disp ( abs ( Acm ) ,” V a l u e o f | Acm | i n V/V i s : ” )
34 CMRRindB = 20* log10 ( abs ( Ad ) / abs ( Acm ) ) ; // i n dB
35 disp ( round ( CMRRindB ) ,”CMRR i n dB i s : ” )

Scilab code Exa 4.12 Value of Gm Ro Ad and Rid

1 // Exa 4 . 1 2
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 I =0.8; // i n mA
7 I = I *10^ -3; // i n A
8 V_A = 100; // i n V
9 Bita =160;
10 VT =25; // i n mV
11 VT = VT *10^ -3; // i n V
12 gm = ( I /2) / VT ; // i n A/V
13 Gm = gm ; // S h o r t c i r c u i t t r n s c o n d u c t a n c e i n mA/V
14 disp ( Gm *10^3 , ” The v a l u e o f Gm i n mA/V” )
15 ro2 = V_A /( I /2) ; // i n ohm
16 ro4 = ro2 ; // i n ohm
17 Ro = ro2 * ro4 /( ro2 + ro4 ) ; // i n ohm
18 disp ( Ro *10^ -3 , ” The v a l u e o f Ro i n k i s : ”)
19 Ad = Gm * Ro ; // i n V/V
20 disp ( Ad , ” V a l u e o f Ad i n V/V i s : ” )
21 r_pi = Bita / gm ; // i n
22 Rid = 2* r_pi ; // i n
23 disp ( Rid *10^ -3 , ” The v a l u e o f Rid i n k i s : ”)

Scilab code Exa 4.13 Value of VOV and VGS

1 // Exa 4 . 1 3

89
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 Vtp = -0.8; // i n V
7 KpWL = 3.5; // i n mA/Vˆ2
8 I =0.7; // i n mA
9 I = I *10^ -3; // i n A
10 R_D = 2; // i n k
11 R_D = R_D *10^3; // i n
12 KpWL = KpWL *10^ -3; // i n A/Vˆ2
13 v_G1 = 0; // i n V
14 v_G2 = v_G1 ; // i n V
15 VSS = 2.5; // i n V
16 VDD = VSS ; // i n V
17 VCS = 0.5; // i n V
18 // P a r t ( a )
19 V_OV = - sqrt ( I / KpWL ) ; // i n V
20 disp ( V_OV , ” The v a l u e o f V OV i n v o l t s i s : ” )
21 V_GS = V_OV + Vtp ; // i n V
22 disp ( V_GS , ” The v a l u e o f V GS i n v o l t s i s : ” )
23 V_G = 0; // a s g a t e i s c o n n e c t e d g r o u n d
24 v_S1 = V_G - V_GS ; // i n V
25 v_S2 = v_S1 ; // i n V
26 disp ( v_S1 , ” The v a l u e o f V S i n v o l t s i s : ” )
27 v_D1 = I /2* R_D - VDD ; // i n V
28 v_D2 = v_D1 ; // i n V
29 disp ( v_D1 , ” The v a l u e o f v D1 i n V i s : ” )
30 disp ( v_D2 , ” The v a l u e o f v D2 i n V i s : ” )
31
32 // P a r t ( b )
33 V_CMmin = I * R_D /2 - VDD + Vtp ; // i n V
34 V_CMmax = VSS - VCS + Vtp + V_OV ; // i n V
35 disp ( V_CMmin , ” The v a l u e o f V CMmin i n v o l t i s : ” )
36 disp ( V_CMmax , ” The v a l u e o f V CMmax i n v o l t i s : ” )

90
Scilab code Exa 4.14 Ratio of W and L

1 // Exa 4 . 1 4
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_OV = 0.2; // i n V
7 gm =1; // i n mA/V
8 gm = gm *10^ -3; // i n A/V
9 Vt =0.8; // i n V
10 unCox = 90; // i n A /Vˆ2
11 unCox = unCox *10^ -6; // i n A/Vˆ2
12 // gm= I /V OV
13 I = gm * V_OV ; // i n A
14 disp ( I *10^3 , ” B i a s c u r r e n t i n mA i s : ” )
15 I_D = I /2; // i n A
16 // Formula I D= 1 /2 ∗ unCox ∗WLn∗V OVˆ2
17 WbyL = 2* I_D /( unCox * V_OV ^2) ;
18 disp ( WbyL , ”W/L r a t i o i s : ” )

Scilab code Exa 4.15 Value of VOV gm ro and Ad

1 // Exa 4 . 1 5
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 I =0.5; // i n mA
7 I = I *10^ -3; // i n A
8 WbyL = 50;
9 unCox = 250; // i n A /Vˆ2

91
10 unCox = unCox *10^ -6; // i n A/Vˆ2
11 V_A = 10; // i n V
12 R_D = 4; // i n k
13 R_D = R_D *10^3; // i n
14 V_OV = sqrt ( I /( WbyL * unCox ) ) ; // i n V
15 disp ( V_OV , ” The v a l u e o f V OV i n V i s : ” )
16 gm = I / V_OV ; // i n A/V
17 disp ( gm *10^3 , ” The v a l u e o f gm i n mA/V i s ” )
18 I_D = I /2; // i n A
19 ro = V_A / I_D ; // i n
20 disp ( ro *10^ -3 , ” The v a l u e o f r o i n k i s : ”)
21 Ad = gm *( R_D * ro /( R_D + ro ) ) ; // i n V/V
22 disp ( Ad , ” The v a l u e o f Ad i n V/V i s : ” )

Scilab code Exa 4.16 Voltage at emitter and outputs

1 // Exa 4 . 1 6
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 I =1; // i n mA
7 I = I *10^ -3; // i n A
8 i_C =1; // i n mA
9 i_C = i_C *10^ -3; // i n A
10 V_CC = 5; // i n V
11 V_CM = -2; // i n V
12 V_BE = 0.7; // i n V
13 R_C = 3; // i n k
14 R_C = R_C *10^3; // i n
15 Alpha =1;
16 Bita =100;
17 V_B = 1; // i n V
18 i_C1 = Alpha * I ; // i n A
19 i_C2 =0;

92
20 v_E = V_B - V_BE ; // i n V
21 disp ( v_E , ” E m i t t e r s v o l t a g e i n v o l t s i s : ” )
22 v_C1 = V_CC - i_C1 * R_C ; // i n V
23 v_C2 = V_CC - i_C2 * R_C ; // i n V
24 disp ( ” Output v o l t a g e i s ” + string ( v_C1 ) + ” V and ” +
string ( v_C2 ) + ” V” )

93
Chapter 5

Feedback Amplifiers

Scilab code Exa 5.1 Percentage of output which is feedback to input

1 // Exa 5 . 1
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 A = 800; // u n i t l e s s
7 Af = 50; // u n i t l e s s
8 // Formula Af= A/(1+ B i t a ∗A)
9 Bita = 1/ Af -1/ A ;
10 disp ( Bita *100 , ” P e r c e n t a g e o f o u t p u t which i s
feedback to the input in % i s ”)

Scilab code Exa 5.2 Value of alpha and bita

1 // Exa 5 . 2
2 clc ;
3 clear ;
4 close ;

94
5 // Given d a t a
6 Af = 100; // u n i t l e s s
7 Vi = 50; // i n mV
8 Vi = Vi *10^ -3; // i n V
9 Vs = 0.5; // i n V
10 // Formula Af= Vo/ Vs
11 Vo = Af * Vs ; // i n V
12 A = Vo / Vi ;
13 disp (A , ” V a l u e o f A i s : ” )
14 // Formula Af= A/(1+B∗A)
15 B = 1/ Af -1/ A ;
16 B = B *100; // i n %
17 disp (B , ” V a l u e o f B i s i n p e r c e n t : ” )

Scilab code Exa 5.3 Value of fL and fH

1 // Exa 5 . 3
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 Bita = 5/100;
7 f_H = 50; // i n kHz
8 f_H = f_H *10^3; // i n Hz
9 f_L = 50; // i n kHz
10 Amid = 1000;
11 f_LF = f_L /(1+ Bita * Amid ) ; // i n Hz
12 f_HF = f_H *(1+ Bita * Amid ) ; // i n Hz
13 disp ( f_LF , ” V a l u e o f f L F i n Hz i s : ” )
14 disp ( f_HF *10^ -6 , ” V a l u e o f f L F i n MHz i s : ” )

Scilab code Exa 5.4 Value of Bita and Af

95
1 // Exa 5 . 4
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 dAf_by_Af = 0.2/100;
7 dA_by_A = 150/2000;
8 A =2000;
9 // Formula d A f b y A f = 1/(1+ B i t a ∗A) ∗ dA by A
10 Bita = dA_by_A /( A * dAf_by_Af ) -1/ A ;
11 Af = A /(1+ Bita * A ) ;
12 disp ( Bita *100 , ” V a l u e o f B i t a i n p e r c e n t i s ” )
13 disp ( Af , ” V a l u e o f Af i s : ” )

Scilab code Exa 5.5 Fraction of the output that is feebback to input

1 // Exa 5 . 5
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 Av = 140;
7 Avf = 17.5;
8 // Formula Avf= Av/(1+Av∗ B i t a )
9 Bita = 1/ Avf -1/ Av ;
10 disp ( Bita , ” F r a c t i o n o f t h e o u t p u t i s ”)

Scilab code Exa 5.6 Fraction of the output voltage feedback

1 // Exa 5 . 6
2 clc ;
3 clear ;
4 close ;

96
5 // Given d a t a
6 Av = 100;
7 Avf = 50;
8 // Formula Avf= Av/(1+Av∗ B i t a )
9 Bita = 1/ Avf -1/ Av ;
10 disp ( Bita , ” The v l a u e o f b i t a i s ” )
11
12 // P a r t ( i i )
13 Avf = 75;
14 // Formula Avf= Av/(1+Av∗ B i t a )
15 Av = Avf /(1 - Bita * Avf )
16 disp ( Av , ” V a l u e o f a m p l i f i e r g a i n i s : ” )

Scilab code Exa 5.7 Percentage reduction in stage gain

1 // Exa 5 . 7
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 Av = 50;
7 Avf = 25;
8 // Formula Avf= Av/(1+Av∗ B i t a )
9 Bita = 1/ Avf -1/ Av ;
10 // P a r t ( i )
11 Av =50;
12 Avf = 40;
13 Perc_reduction = ( Av - Avf ) / Av *100; // P e r c e n t a g e o f
reduction in stage gain in %
14 disp ( Perc_reduction , ” Without f e e d b a c k , p e r c e n t a g e o f
r e d u c t i o n in s t a g e gain in % i s : ”)
15
16 // P a r t ( i i )
17 Av = 40;
18 Avf = 25;

97
19 gain_with_neg_feed = Av /(1+ Bita * Av ) ;
20 Perc_reduction = ( Avf - gain_with_neg_feed ) / Avf *100; //
in %
21 disp ( Perc_reduction , ” With f e e d b a c k , p e r c e n t a g e
r e d u c t i o n in s t a g e gain in % i s : ”)

Scilab code Exa 5.8 Bandwidth of a feedback amplifiers

1 // Exa 5 . 8
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 Ao = 10^4;
7 Afo = 50;
8 omega_H = 2* %pi *100; // i n r a d / s
9 // Formula Afo= Ao/(1+Ao∗ B i t a )
10 Bita = 1/ Afo -1/ Ao ;
11 omega_f_H = omega_H *(1+ Ao * Bita ) ;
12 disp ( ” C l o s e d l o o p bandwidth i n r a d / s i s : ”)
13 disp ( string ( omega_f_H ) + ” o r 2∗ %pi ∗ 2 0 ∗ 1 0 ˆ 3 ” ) ;
14 disp ( ” So t h e bandwidth i n c r e a s e form 100 Hz t o 20
kHz on t h e g a i n d e c r e a s e s form 104 t o 50 ” )

Scilab code Exa 5.10 Value of Av bita Avf Ri Rif Ro Rof

1 // Exa 5 . 1 0
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 gm =50;
7 R_E = 100; // i n ohm

98
8 R_S = 1; // i n kohm
9 R_S = R_S *10^3; // i n ohm
10 r_pi = 1100; // i n ohm
11 h_ie = r_pi ;
12 // Formula Av= Vo/Vs , But Vo= gm∗ v p i ∗R E and Vs= I b
∗ ( Ri+r p i ) , s o
13 Av = gm * R_E /( R_S + h_ie )
14 // As Vo=Vf , s o
15 Bita =1;
16 D = 1+ Bita * Av ;
17 Avf = Av / D ;
18 Ri = R_S + r_pi ; // i n ohm
19 Ri = Ri *10^ -3; // i n kohm
20 R_if = Ri * D ; // i n kohm
21 // Ro= i n f i n i t e , s o
22 // Rof= i n f i n i t e
23 disp ( Av , ” V a l u e o f Av i s : ” )
24 disp ( Bita , ” V a l u e o f B i t a i s : ” )
25 disp ( Avf , ” V a l u e o f Avf i s : ” )
26 disp ( Ri , ” V a l u e o f Ri i n kohm” )
27 disp ( R_if , ” V a l u e o f R i f i n kohm i s : ” )
28 disp ( ” V a l u e o f Rof i s : ” )
29 disp ( ” i n f i n i t e ” )

Scilab code Exa 5.11 Value of Avf Rif Rof and bita

1 // Exa 5 . 1 1
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 gm =2; // i n mA/V
7 gm = gm *10^ -3; // i n A/V
8 r_d = 40; // i n kohm
9 r_d = r_d *10^3; // i n ohm

99
10 Rs = 3; // i n kohm
11 Rs = Rs *10^3; // i n ohm
12 miu = gm * r_d ;
13 Bita =1;
14 Av = miu * Rs /( r_d + Rs ) ;
15 D = 1+ Bita * Av ;
16 Avf = Av / D ;
17 // Ri= i n f i n i t e , s o R i f = Ri ∗D = i n f i n i t e
18 Rof = r_d / D ; // i n ohm
19 disp ( Av , ” V a l u e o f Av i s : ”)
20 disp (D , ” V a l u e o f D i s ” )
21 disp ( Avf , ” V a l u e o f Avf i s : ”)
22 disp ( ” V a l u e o f R i f i s ” )
23 disp ( ” i n f i n i t e ” )
24 disp ( Rof , ” V a l u e o f Rof i n ohm i s : ” )

Scilab code Exa 5.12 Value of D Gmf Rif and Rof

1 // Exa 5 . 1 2
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 gm =75; // i n A/V
7 Rs = 1; // i n kohm
8 Rs = Rs *10^3; // i n ohm
9 R_E = 1; // i n kohm
10 R_E = R_E *10^3; // i n ohm
11 rpi = 1; // i n kohm
12 rpi = rpi *10^3; // i n ohm
13 hie = rpi ;
14
15 Io = - gm ;
16 Vi = Rs + R_E + rpi ;
17 Gm = Io / Vi ;

100
18 disp ( Gm , ” V a l u e o f Gm i s : ” )
19 Bita = - R_E ;
20 disp ( Bita , ” V a l u e o f B i t a i s : ” )
21 D = 1+ Bita * Gm ;
22 disp (D , ” V a l u e o f D i s : ” )
23 Gmf = Gm / D ;
24 disp ( Gmf , ” V a l u e o f Gmf i s : ” )
25 Ri = Rs + R_E + hie ; // i n ohm
26 Rif = Ri * D ; // i n ohm
27 Rif = Rif *10^ -3; // i n kohm
28 disp ( Rif , ” V a l u e o f R i f i n kohm i s : ” )
29 // Ro= i n f i n i t e , s o R o f = Ro∗D = i n f i n i t e
30 disp ( ” V a l u e o f R o f i s ” )
31 disp ( ” i n f i n i t e ” )

Scilab code Exa 5.19 Percentage change in Af

1 // Exa 5 . 1 9
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 A = 10^5;
7 Af = 100;
8 // Formula Af= A/(1+A∗ B i t a )
9 Bita = 1/ Af -1/ A ;
10
11 // when A= 1 0 ˆ 3
12 A =10^3;
13 Af_desh = A /(1+ A * Bita ) ;
14
15 delta_Af = Af_desh - Af ;
16 Perc_Change_inAf = delta_Af / Af *100; // i n %
17 disp ( Perc_Change_inAf , ” P e r c e n t a g e c h a n g e i n Af i s :
”)

101
Scilab code Exa 5.20 Percentage gain deduction

1 // Exa 5 . 2 0
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 A = 100;
7 Vs =1; // i n v o l t
8 Bita =1; // a s i n t h e v o l t a g e f o l l o w e r , the output
v o l t a g e i s same a s i n p u t
9 Af = A /(1+ Bita * A ) ;
10 CLG = 1+ A * Bita ; // c l o s e d l o o p g a i n
11 disp ( CLG , ” C l o s e d l o o p g a i n i s : ” )
12 CLG_dB = 20* log10 ( CLG ) ;
13 disp ( CLG_dB , ” C l o s e d l o o p g a i n i n dB i s : ” )
14 Vo = Af * Vs ; // i n V
15 disp ( Vo , ” V a l u e o f Vo i n v o l t i s : ” )
16 Vi = Vs - Vo ; // i n V
17 disp ( round ( Vi *10^3) ,” V a l u e o f Vi i n mV i s : ” )
18 // I f A d e c r e a s e 10%, i . e .
19 A =90;
20 Af_desh = A /(1+ Bita * A ) ;
21 Per_gain_reduction = ( Af_desh - Af ) / Af *100; // i n %
22 disp ( Per_gain_reduction , ” P e r c e n t a g e o f g a i n
r e d u c t i o n i n %” )

Scilab code Exa 5.21 Open loop gain and loop gain

1 // Exa 5 . 2 1
2 clc ;

102
3 clear ;
4 close ;
5 // Given d a t a
6 // P a r t ( a )
7 PerError = 1; // i n %
8 A = 10^5; // ( Assumed v a l u e )
9 ABita = 1/ PerError *100;
10 Bita = 1/( PerError * A ) ;
11 disp ( ”% e r r o r A A
1+ A ” )
12 disp ( string ( PerError ) + ” ” + string (
A)+” ” + string ( ABita ) + ”
” + string (1+ ABita ) )
13 // P a r t ( b )
14 PerError = 5; // i n %
15 ABita = 1/ PerError *100;
16 Bita = 1/( PerError * A ) ;
17 disp ( string ( PerError ) + ” ” + string (
A)+” ” + string ( ABita ) + ”
” + string (1+ ABita ) )
18 // P a r t ( c )
19 PerError = 50; // i n %
20 ABita = 1/ PerError *100;
21 Bita = 1/( PerError * A ) ;
22 disp ( string ( PerError ) + ” ” + string ( A )
+” ” + string ( ABita ) + ”
” + string (1+ ABita ) )

Scilab code Exa 5.22 Value of AB

1 // Exa 5 . 2 2
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a

103
6 S = -20; // s e n s i t i v i t y o f c l o s e d t o open l o o p g a i n i n
dB
7 // s e n s i t i v i t y o f c l o s e d t o open l o o p g a i n = 1/(1+AB
) = S
8 // o r (1+AB) = −S
9 AB = 10^( - S /20) - 1;
10 disp ( AB , ” The l o o p g a i n AB f o r which t h e s e n s i t i v i t y
o f c l o s e d l o o p g a i n t o open l o o p g a i n i s −20 dB ,
i s : ”)
11
12 // P a r t ( b ) when
13 S = 1/2; // s e n s i t i v i t y o f c l o s e d t o open l o o p g a i n i n
dB
14 // S= 1/(1+AB)
15 AB = 1/ S -1;
16 disp ( AB , ” The l o o p g a i n AB f o r which t h e s e n s i t i v i t y
o f c l o s e d l o o p g a i n t o open l o o p g a i n i s 1/2 , i s
: ”)

Scilab code Exa 5.23 Gain densitivity factor

1 // Exa 5 . 2 3
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 A =10^5;
7 Af = 10^3;
8 // Af= A/(1+A∗ B i t a )
9 Bita = 1/ Af -1/ A ;
10 GDF = 1+ A * Bita ; // g a i n d e n s i t i v i t y f a c t o r
11 disp ( GDF , ” Gain d e n s i t i v i t y f a c t o r i s : ” )
12 // P a r t ( a ) when A d r o p s 10 %
13 A_desh = A - A *10/100;
14 Af_desh = A_desh /(1+ A_desh * Bita ) ;

104
15 CorresPer = ( Af - Af_desh ) / Af *100; // c o r r e s p o n d i n g
percentage in %
16 disp ( CorresPer , ”When A d r o p s by 10 % t h e n
co rr es po nd in g percentage i s ”)
17 // P a r t ( b ) when A d r o p s 30 %
18 A_desh = A - A *30/100;
19 Af_desh = A_desh /(1+ A_desh * Bita ) ;
20 CorresPer = ( Af - Af_desh ) / Af *100; // c o r r e s p o n d i n g
percentage in %
21 disp ( CorresPer , ”When A d r o p s by 30 % t h e n
co rr es po nd in g percentage i s ”)

Scilab code Exa 5.24 Upper and lower 3dB frequency

1 // Exa 5 . 2 4
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 A =100;
7 Af = 10;
8 f_L = 100; // i n Hz
9 f_H = 10; // i n kHz
10 // Af= A/(1+A∗ B i t a )
11 Bita = 1/ Af -1/ A ;
12 f_desh_L = f_L /(1+ A * Bita ) ; // i n Hz
13 f_desh_H = f_H /(1+ A * Bita ) ; // i n kHz
14 disp ( f_desh_L , ”Low f r e q u e n c y i n Hz i s : ” )
15 disp ( f_desh_H , ” High f r e q u e n c y i n kHz i s : ” )
16
17 // Note : I n t h e book C a l c u l a t i o n t o f i n d t h e v a l u e
o f h i g h f r e q u e n c y i . e . f d e s h H i s wrong s o t h e
a n s w e r i n t h e book i s wrong

105
Scilab code Exa 5.25 Value of alpha and bita

1 // Exa 5 . 2 5
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 Vs = 100; // i n mV
7 Vf = 95; // i n mV
8 Vs = Vs *10^ -3; // i n V
9 Vf = Vf *10^ -3; // i n V
10 Vo =10; // i n V
11 Vi = Vs - Vf ; // i n V
12 Av = Vo / Vi ; // i n V/V
13 disp ( Av , ” V a l u e o f A i n V/V i s : ” )
14 Bita = Vf / Vo ; // i n V/V
15 disp ( Bita , ” V a l u e o f B i t a i n V/V i s : ” )
16
17 // Note : I n t h e book C a l c u l a t i o n t o f i n d t h e v a l u e
o f B i t a i s wrong s o t h e a s n w e r i n t h e book i s
wrong

Scilab code Exa 5.26 Value of alpha and bita

1 // Exa 5 . 2 6
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 Is = 100; // i n A
7 Is = Is *10^ -6; // i n A
8 If = 95; // i n A

106
9 If = If *10^ -6; // i n A
10 Io = 10; // i n mA
11 Io = Io *10^ -3; // i n A
12 A = Io /( Is - If ) ; // n A/A
13 Bita = If / Io ; // A/A
14 disp (A , ” V a l u e o f A i n A/A i s : ” )
15 disp ( Bita , ” V a l u e o f B i t a i n A/A i s : ” )
16
17 // Note : I n t h e book , t o e v a l u a t i n g t h e v a l u e o f
B i t a , t h e y p u t t e d wrong v a l u e o f I f ( 9 5 a t p l a c e
of 90)

Scilab code Exa 5.28 Gain input resistance and output resistance of the closed loo

1 // Exa 5 . 2 8
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 A =2000; //V/V
7 Bita = 0.1; // inV /V
8 Ri = 1; // i n kohm
9 Ri = Ri *10^3; // i n ohm
10 Ro = 1; // i n kohm
11 Ro = Ro *10^3; // i n ohm
12 Af = A /(1+ A * Bita ) ;
13 disp ( Af , ” The g a i n Af i n v o l t i s : ” )
14 Rif = Ri *(1+ A * Bita ) ; // i n ohm
15 disp ( Rif *10^ -3 , ” The i n p u t r e s i s t a n c e i n kohm i s : ” )
16 Rof = Ro /(1+ A * Bita ) ; // i n ohm
17 disp ( Rof *10^ -3 , ” The o u t p u t r e s i s t a n c e i n kohm i s : ”
)
18
19
20 // Note : I n t h e book , t o f i n d i n g t h e v a l u e o f Af ,

107
R i f and Rof t h e r e i s m i s s p r i n t i n g t o p u t t i n g t h e
v a l u e o f B i t a but v a l u e o f Af and R i f i s c o r r e c t
b e c a u s e t o c a l c u l a t i n g Af and R i f , t h e v a l u e o f
Bita i s taken . 1 ( not . 0 1 )
21 // but t o e v a l u a t i n g t h e v a l u e o f Rof
c a l c u l a t i o n i s a l s o wrong s o t h e a n s w e r i n t h e
book i s wrong

Scilab code Exa 5.29 Closed loop voltage gain

1 // Exa 5 . 2 9
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6
7 // P a r t ( b )
8 Af = 10;
9 A = 10^4;
10 // Af= A/(1+A∗ B i t a ) ;
11 Bita = 1/ Af -1/ A ;
12 // B i t a= R1 / ( R1+R2 )
13 R2_by_R1 = 1/ Bita -1;
14 disp ( R2_by_R1 , ” V a l u e o f R2/R1 i s : ” )
15
16 // P a r t ( c )
17 Vs = 1; // i n V
18 Vo = (1+ R2_by_R1 ) * Vs ;
19 disp ( Vo , ” V a l u e o f Vo i n v o l t i s : ” )
20 Vf = Vo /(1+ R2_by_R1 )
21 disp ( Vf , ” V a l u e o f Vf i n v o l t i s : ” )

108
Chapter 6

Oscillators

Scilab code Exa 6.1 Minimum gain of the amplifier to provide oscillation

1 // Exa 6 . 1
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 Vf = 0.0125; // i n v o l t
7 Vo = 0.5; // i n v o l t
8 Bita = Vf / Vo ;
9 // For o s c i l l a t o r A∗ B i t a= 1
10 A = 1/ Bita ;
11 disp ( ” A m p l i f i e r S h o u l d have a minimum g a i n o f ” +
string ( A ) + ” t o p r o v i d e o s c i l l a t i o n ” )

Scilab code Exa 6.2 The frequency of oscillation

1 // Exa 6 . 2
2 clc ;
3 clear ;

109
4 close ;
5 // Given d a t a
6 R1 = 50; // i n kohm
7 R1 = R1 *10^3; // i n ohm
8 R2 = R1 ; // i n ohm
9 R3 = R2 ; // i n ohm
10 C1 = 60; // i n pF
11 C1 = C1 *10^ -12; // i n F
12 C2 = C1 ; // i n F
13 C3 = C2 ; // i n F
14 f = 1/(2* %pi * R1 * C1 * sqrt (6) ) ;
15 disp ( f *10^ -3 , ” F r e q u e n c y o f o s c i l l t i o n s i n kHz i s : ”
)

Scilab code Exa 6.3 Wein Bridge oscillator

1 // Exa 6 . 3
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 f =2; // i n kHz
7 f = f *10^3; // i n Hz
8 // L e t
9 R = 10; // i n kohm ( As R s h o u l d be g r e a t e r t h a n 1
kohm )
10 R = R *10^3; // i n ohm
11 // Formula f= 1 / ( 2 ∗ %pi ∗R∗C)
12 C = 1/(2* %pi * f * R ) ; // i n F
13 C = C *10^9; // i n nF
14 // For B i t a t o be 1 / 3 , Choose
15 R4 = R ; // i n ohm
16 R3 = 2* R4 ; // i n ohm
17 disp (C , ” V a l u e o f C i n nF i s : ” )
18 disp ( R3 *10^ -3 , ” V a l u e o f R3 i n kohm i s : ” )

110
19 disp ( R4 *10^ -3 , ” V a l u e o f R4 i n kohm i s : ” )

Scilab code Exa 6.4 Frequency of oscillations

1 // Exa 6 . 4
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 R1 = 200; // i n kohm
7 R1 = R1 *10^3; // i n ohm
8 R2 = R1 ; // i n ohm
9 C1 = 200; // i n pF
10 C1 = C1 *10^ -12; // i n F
11 C2 = C1 ; // i n F
12 f = 1/(2* %pi * R1 * C1 ) ; // i n Hz
13 disp ( f *10^ -3 , ” F r e q u e n c y o f o s c i l l t i o n s i n kHz i s : ”
)
14
15 // Note : C a l c u l a t i o n t o f i n d t h e v a l u e o f f i n t h e
book i s wrong , s o a n s w e r i n t h e book i s wrong

Scilab code Exa 6.5 Operating frequency

1 // Exa 6 . 5
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 L = 100; // i n H
7 L = L *10^ -6; // i n H
8 C1 = .001; // i n F
9 C1 = C1 *10^ -6; // i n F

111
10 C2 = .01; // i n F
11 C2 = C2 *10^ -6; // i n F
12 C = C1 * C2 /( C1 + C2 ) ; // i n F
13 // ( i )
14 f = 1/(2* %pi * sqrt ( L * C ) ) ; // i n Hz
15 disp ( round ( f *10^ -3) ,” O p e r a t i n g f r e q u e n c y i n kHz i s :
”)
16 // ( i i )
17 Bita = C1 / C2 ;
18 disp ( Bita , ” Feed back f r a c t i o n i s : ” )
19 // ( i i i )
20 // A∗ B i t a >=1, s o Amin∗ B i t a= 1
21 Amin = 1/ Bita ;
22 disp ( Amin , ”Minimum g a i n t o s u b s t a i n o s c i l l a t i o n s i s
: ”)

Scilab code Exa 6.6 Operating frequency

1 // Exa 6 . 6
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 L = 15; // i n H
7 L = L *10^ -6; // i n H
8 C1 = .004; // i n F
9 C1 = C1 *10^ -6; // i n F
10 C2 = .04; // i n F
11 C2 = C2 *10^ -6; // i n F
12 C = C1 * C2 /( C1 + C2 ) ; // i n F
13 f = 1/(2* %pi * sqrt ( L * C ) ) ; // i n Hz
14 disp ( f *10^ -3 , ” F r e q u e n c y o f o s c i l l a t i o n s i n kHz i s :
”)

112
Scilab code Exa 6.7 Frequency of oscillaiton

1 // Exa 6 . 7
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 L = 0.01; // i n H
7 C = 10; // i n pF
8 C = C *10^ -12; // i n F
9 f = 1/(2* %pi * sqrt ( L * C ) ) ; // i n Hz
10 disp ( f *10^ -3 , ” F r e q u e n c y o f o s c i l l a t i o n s i n kHz i s :
”)
11
12 // Note : C a l c u l a t i o n t o f i n d t h e v a l u e o f f i n t h e
book i s wrong , s o a n s w e r i n t h e book i s wrong

Scilab code Exa 6.8 Value of fs and fp

1 // Exa 6 . 8
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 L = 0.8; // i n H
7
8 C = .08; // i n pF
9 C = C *10^ -12; // i n F
10 C_M = 1.9; // i n pF
11 C_M = C_M *10^ -12; // i n F
12 C_T = C * C_M /( C + C_M ) ; // i n F
13 R =5; // i n kohm

113
14 f_s = 1/(2* %pi * sqrt ( L * C ) ) ; // i n Hz
15 disp ( f_s *10^ -3 , ” S e r i e s r e s o n a n t f r e q u e n c y i n kHz i s
: ”)
16 // ( i i )
17 f_p = 1/(2* %pi * sqrt ( L * C_T ) ) ; // i n Hz
18 disp ( f_p *10^ -3 , ” p a r a l l e l r e s o n a n t f r e q u e n c y i n kHz
i s : ”)
19
20 // Note : C a l c u l a t i o n t o f i n d t h e v a l u e o f p a r a l l e l
r e s o n a n t f r e q u e n c y i n t h e book i s wrong , s o
a n s w e r i n t h e book i s wrong

Scilab code Exa 6.10 Frequency of oscillaiton

1 // Exa 6 . 1 0
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 R1 = 220; // i n kohm
7 R1 = R1 *10^3; // i n ohm
8 R2 = R1 ; // i n ohm
9 C1 = 250; // i n pF
10 C1 = C1 *10^ -12; // i n F
11 C2 = C1 ; // i n F
12 f = 1/(2* %pi * R1 * C1 ) ;
13 disp (f , ” F r e q u e n c y o f o s c i l l t i o n s i n Hz i s : ” )

Scilab code Exa 6.11 Value of C

1 // Exa 6 . 1 1
2 clc ;
3 clear ;

114
4 close ;
5 // Given d a t a
6 R = 10; // i n kohm
7 R = R *10^3; // i n ohm
8 f =1000;
9 fie = 60; // i n
10 // The i m p e d e n c e o f g i v e n c i r c u i t , Z= R+j ∗ 1 / ( omega ∗
C)
11 // t h e p h a s e s h i f t , t a n ( f i e )= i m a g i n a r y p a r t / R e a l
part
12 // t a n d ( f i e ) = 1 / ( omega ∗R∗C)
13 C = 1/(2* %pi * R * tand ( fie ) ) ;
14 disp ( C *10^12 , ” The v a l u e o f C i n pF i s : ” )
15
16 // Note : There i s an c a l c u l a t i o n e r r o r t o e v a l u a t e
t h e v a l u e o f C , So t h e a n s w e r i n t h e book i s
wrong

Scilab code Exa 6.12 Frequency of oscillaiton and minimum gain

1 // Exa 6 . 1 2
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 L = 50; // i n H
7 L = L *10^ -6; // i n H
8 C1 = 300; // i n pF
9 C1 = C1 *10^ -12; // i n F
10 C2 = 100; // i n pF
11 C2 = C2 *10^ -12; // i n F
12 C_eq = C1 * C2 /( C1 + C2 ) ; // i n F
13 f = 1/(2* %pi * sqrt ( L * C_eq ) ) ; // i n Hz
14 disp ( f *10^ -6 , ” F r e q u e n c y o f o s c i l l a t i o n s i n MHz i s :
”)

115
15 Bita = C2 / C1 ;
16 // ( i i i )
17 // A∗ B i t a >=1, s o A∗ B i t a= 1 ( f o r s u s t a i n e d
oscillations )
18 Amin = 1/ Bita ;
19 disp ( Amin , ”Minimum g a i n t o s u b s t a i n o s c i l l a t i o n s is
: ”)

Scilab code Exa 6.14 The range of capacitance

1 // Exa 6 . 1 4
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 L1 = 2; // i n mH
7 L1 = L1 *10^ -3; // i n H
8 L2 = 1.5; // i n mH
9 L2 = L2 *10^ -3; // i n H
10 // Formula f= 1 / ( 2 ∗ %pi ∗ s q r t ( ( L1+L2 ) ∗C)
11 // For f= 1 0 0 0 kHz , C w i l l be maximum
12 f =1000; // i n kHz
13 f = f *10^3; // i n Hz
14 Cmax = 1/((2* %pi * f ) ^2*( L1 + L2 ) ) ; // i n F
15 // For f= 2 0 0 0 kHz , C w i l l be maximum
16 f =2000; // i n kHz
17 f = f *10^3; // i n Hz
18 Cmin = 1/((2* %pi * f ) ^2*( L1 + L2 ) ) ; // i n F
19 disp ( Cmin *10^12 , ”Minimum C a p a c i t a n c e i n pF i s : ” )
20 disp ( Cmax *10^12 , ”Maximum C a p a c i t a n c e i n pF i s : ” )

116
Chapter 7

Examintion Paper

Scilab code Exa 1.b The value of V1 and V0

1 // Exa 1 . b
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 R1 = 10; // i n k
7 R2 = 10; // i n k
8 Rf = 50; // i n k
9 V = 2; // i n V
10 V1 = V * R1 /( R1 + R2 ) ; // i n V
11 V01 = - Rf / R1 * V1 ; // i n V
12 disp ( V1 , ” The v a l u e o f V1 i n v o l t s i s : ” )
13 disp ( V01 , ” The v a l u e o f V01 i n v o l t s i s : ” )
14 disp ( ” Only 2 V s o u r c e t h e n t h e c i r c u i t a c t s a s non−
i n v e r t i n g a m p l i f i e r ”)

Scilab code Exa 2.a The value of ID and VD

117
1 // Exa 2 . a
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_P = -4; // i n V
7 I_DSS = 10; // i n mA
8 V_GS = 0; // i n V
9 R_D = 1.8; // i n k
10 V_DD = 20; // i n V
11 I_D = I_DSS *(1 - V_GS / V_P ) ^2; // i n mA
12 // A p p l y i n g KVL t o t h e c i r c u i t , we g e t V DD= I D ∗R D
+V D
13 V_D = V_DD - I_D * R_D ; // i n V
14 disp ( I_D , ” The v a l u e o f I D i n mA i s : ” )
15 disp ( V_D , ” The v a l u e o f V D i n v o l t s i s : ” )

Scilab code Exa 2.c ON resistance of an NMOS transistor

1 // Exa 2 . c
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 V_GS = 3; // i n V
7 Vth = 1; // i n V
8 unCox = 25; // i n mA/Vˆ2
9 unCox = unCox *10^ -3; // i n A/Vˆ2
10 W =3; // i n m
11 L =1; // i n m
12 r_DS = 1/( unCox * W / L *( V_GS - Vth ) ) ; // i n
13 disp ( r_DS , ” The v a l u e o f r DS i n i s : ”)

118
Scilab code Exa 3.b The value of RE RB and delta ICQ

1 // Exa 3 . b
2 clc ;
3 clear ;
4 close ;
5 // Given d a t a
6 I_CQ = 10; // i n mA
7 I_CQ = I_CQ *10^ -3; // i n A
8 V_CQ = 5; // i n V
9 V_CC = 10; // i n V
10 R_C = 0.4; // i n k
11 R_C = R_C *10^3; // i n
12 V_BE = 0.075; // i n V
13 V_BB = 0.175; // i n V
14 bita =100;
15 bita_max =120;
16 bita_min = 40;
17 // A p p l y i n g KVL we g e t , V CQ= V CC−I C ∗ ( R C+R E )
18 R_E = ( V_CC - V_CQ ) / I_CQ - R_C ; // i n
19 disp ( R_E , ” The v a l u e o f R E i n i s : ”)
20 I_B = I_CQ / bita ; // i n A
21 R_B = ( V_BB - V_BE ) / I_B ; // i n
22 disp ( R_B *10^ -3 , ” The v a l u e o f R B i n k ” )
23 I_Cmax = bita_max * I_B ; // i n A
24 I_Cmin = bita_min * I_B ; // i n A
25 delta_I_CQ = I_Cmax - I_Cmin ; // i n A
26 disp ( delta_I_CQ *10^3 , ” The v a l u e o f d e l t a I C i n mA
i s : ”)

119

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy