summaryrefslogtreecommitdiff
path: root/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter8.ipynb
blob: be4f9dc65d81c8de6cff78fceaff16c5f95ba5d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
{

 "metadata": {

  "name": "",

  "signature": "sha256:083d39cbb0b520b2793c0213a9dd654eda9ff785157da84f0bec629956fa17a6"

 },

 "nbformat": 3,

 "nbformat_minor": 0,

 "worksheets": [

  {

   "cells": [

    {

     "cell_type": "heading",

     "level": 1,

     "metadata": {},

     "source": [

      "Chapter08: Feedback"

     ]

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex8.1:pg-808"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "# Example 8.1: Analysis of op amp connected in an inverting configuration\n",

      "# By inspection we can write down the expressions for A, B , closed loop gain , the input resistance and the output resistance\n",

      "u=10**4; # (ohm)\n",

      "R_id=100.0*10**3; # (ohm)\n",

      "r_o=1000.0; # (ohm)\n",

      "R_L=2000.0; # (ohm)\n",

      "R_1=1000.0; # (ohm)\n",

      "R_2=10.0**6; # (ohm)\n",

      "R_S=10000.0; # (ohm)\n",

      "A=u*(R_L*(R_1+R_2)/(R_L+R_1+R_2))*R_id/(((R_L*(R_1+R_2))/(R_L+R_1+R_2)+r_o)*(R_id+R_S+(R_1*R_2)/(R_1+R_2)))\n",

      "print int(A),\"= Voltage gain without feedback (V/V)\"\n",

      "B=R_1/(R_1+R_2); # Beta value\n",

      "print round(B,5), \"= Beta value \"\n",

      "A_f=A/(1.0+A*B);\n",

      "print int(A_f),\"= Voltage gain with feedback (V/V)\"\n",

      "R_i=R_S+R_id+(R_1*R_2/(R_1+R_2))# Input resistance of the A circuit in fig 8.12a of textbook\n",

      "R_if=R_i*7;\n",

      "R_in=R_if-R_S;\n",

      "print round(R_in/1000.0,1),\"= Input resistance (Kohm)\"\n",

      "R_o=1.0/(1/r_o+1/R_L+1/(R_1+R_2));\n",

      "R_of=R_o/(1.0+A*B); \n",

      "R_out=R_of*R_L/(R_L-R_of);\n",

      "print round(R_out),\"= the output resistance (ohm)\"\n",

      "# the answer for input resistance is incorrect in the textbook"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "6002 = Voltage gain without feedback (V/V)\n",

        "0.001 = Beta value \n",

        "857 = Voltage gain with feedback (V/V)\n",

        "767.0 = Input resistance (Kohm)\n",

        "100.0 = the output resistance (ohm)\n"

       ]

      }

     ],

     "prompt_number": 9

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex8.2:pg-815"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "# Example 8.2: Feedback triple\n",

      "# Consider the given three stage series-series feedback\n",

      "h_fe=100.0;\n",

      "g_m2=40.0*10**-3; # (A/V)\n",

      "r_e1=41.7; # (ohm)\n",

      "a_1=0.99; # alpha value\n",

      "R_C1=9000.0; # (ohm)\n",

      "R_E1=100.0; #(ohm)\n",

      "R_F=640.0; # (ohm)\n",

      "R_E2=100.0; #(ohm)\n",

      "r_pi2=h_fe/g_m2;\n",

      "R_C2=5000.0; # (ohm)\n",

      "r_e3=6.25; # (ohm)\n",

      "R_C3=800.0; #(ohm)\n",

      "# First stage gain A_1=V_c1/V_i\n",

      "A_1=-a_1*R_C1*r_pi2/((R_C1+r_pi2)*(r_e1+((R_E1*(R_F+R_E2))/(R_E1+R_F+R_E2)))) \n",

      "print round(A_1,2),\"=The voltage gain of the first stage (V/V)\"\n",

      "# Gain of the second stage A_2=Vc2/V_c1\n",

      "A_2=-g_m2*((R_C2*(h_fe+1)/(R_C2+h_fe+1))*(r_e3+(R_E2*(R_F+R_E1))/(R_E2+R_F+R_E1)))\n",

      "print round(A_2,1),\"=The second stage gain (V/V)\"\n",

      "# Third stage gain A_3 I_O/V_i\n",

      "A_3=1/(r_e3+(R_E2*(R_F+R_E1)/(R_E2+R_F+R_E1)));\n",

      "print round(A_3*1000,1),\"=The third stage gain (mA/V)\"\n",

      "A=A_1*A_2*A_3; # combined gain\n",

      "print A,\"=Combined gain (V/V)\"\n",

      "B=R_E1*R_E2/(R_E2+R_F+R_E1);\n",

      "print B,\"=Beta value\"\n",

      "A_f=A/(1.0+A*B);\n",

      "print round(A_f*1000.0,2),\"=Closed loop gain (mA/V)\"\n",

      "A_v=-A_f*R_C3; # Voltage gain\n",

      "print round(A_v,1),\"=Voltage gain (V/V)\"\n",

      "R_i=(h_fe+1)*(r_e1+(R_E1//(R_F+R_E2))/(R_E1+R_F+R_E2));\n",

      "R_if=R_i*(1+A*B);\n",

      "print round(R_if/1e6,1),\"=Input resistance (Mohm)\"\n",

      "R_o=(R_E2//(R_F+R_E1)/(R_F+R_E1+R_E2))+r_e3+R_C2/(h_fe+1);\n",

      "R_of=R_o*(1.0+A*B);\n",

      "print round(R_of/1000,1),\"=Output voltage (kohm)\"\n",

      "r_o=25000; # (ohm)\n",

      "g_m3=160*10**-3; # (mho)\n",

      "r_pi3=625; # (ohm)\n",

      "R_out=r_o+(1+g_m3*r_o)*R_of*r_pi3/(R_of+r_pi3);\n",

      "print round(R_out/1e6,1),\"=R_out (Mohm)\"\n",

      " # the answer in the textbook is slightly dirfferent due to approximation"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "-14.92 =The voltage gain of the first stage (V/V)\n",

        "-373.6 =The second stage gain (V/V)\n",

        "10.6 =The third stage gain (mA/V)\n",

        "59.0958738355 =Combined gain (V/V)\n",

        "11.9047619048 =Beta value\n",

        "83.88 =Closed loop gain (mA/V)\n",

        "-67.1 =Voltage gain (V/V)\n",

        "3.0 =Input resistance (Mohm)\n",

        "39.3 =Output voltage (kohm)\n",

        "2.5 =R_out (Mohm)\n"

       ]

      }

     ],

     "prompt_number": 14

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex8.3:pg-821"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "# Example 8.3 : Small signal analysis\n",

      "B=100.0; # beta value\n",

      "I_B=0.015*10**-3; # (A)\n",

      "I_C=1.5*10**-3; # (A)\n",

      "V_C=4.7; # (V)\n",

      "g_m=40.0*10**-3;\n",

      "R_f=47000.0;\n",

      "R_S=10000.0;\n",

      "R_C=4700.0;\n",

      "r_pi=B/g_m;\n",

      "A=-358.7*10**3; # V_o/I_i= -g_m(R_f||R_C)(R_S||R_F||r_pi)\n",

      "R_i=1400.0; # R_i=R_S||R_f||r_pi (ohm)\n",

      "R_o=R_C*R_f/(R_C+R_f); \n",

      "B=-1/R_f;\n",

      "A_f=A/(1.0+A*B); # V_o/I_s\n",

      "A_v=A_f/R_S; # V_o/V_s\n",

      "print round(A_v,2),\"= The gain (V/V)\"\n",

      "R_if=R_i/(1+A*B);\n",

      "print round(R_if,1),\"= R_if (ohm)\"\n",

      "R_of=R_o/(1+A*B);\n",

      "print round(R_of),\"= R_of (ohm)\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "-4.16 = The gain (V/V)\n",

        "162.2 = R_if (ohm)\n",

        "495.0 = R_of (ohm)\n"

       ]

      }

     ],

     "prompt_number": 18

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex8.4:pg-825"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "# Example 8.4: Small signal analysis\n",

      "R_S=10.0*10**3; # (ohm)\n",

      "R_B1=100.0*10**3; # (ohm)\n",

      "R_B2=15.0*10**3; # (ohm)\n",

      "R_C1=10.0*10**3; # (ohm)\n",

      "R_E1=870.0; # (ohm)\n",

      "R_E2=3400.0; # (ohm)\n",

      "R_C2=8000.0; # (ohm)\n",

      "R_L=1000.0; # (ohm)\n",

      "R_f=10000.0; # (ohm)\n",

      "B=100.0; # beta value\n",

      "V_A=75.0; # (V)\n",

      "A=-201.45 # I_o/I_i (A/A)\n",

      "R_i=1535.0; # (ohm)\n",

      "R_o=2690.0; # (ohm)\n",

      "B=-R_E2/(R_E2+R_f);\n",

      "R_if=R_i/(1+A*B);\n",

      "R_in=1/((1/R_if)-(1/R_S));\n",

      "print round(R_in,1), \"= R_in (ohm)\"\n",

      "A_f=A/(1+A*B); # I_o/I_S\n",

      "gain=R_C2*A_f/(R_C2+R_L); # I_o/I_S\n",

      "print round(gain,2),\"= I_o/I_S (A/A)\"\n",

      "R_of=R_o*(1+A*B); # (ohm)\n",

      "r_o2=75/0.0004; # (ohm)\n",

      "g_m2=0.016; # (A/V)\n",

      "r_pi2=6250; # (ohm)\n",

      "R_out=r_o2*(1+g_m2*(r_pi2*R_of/(r_pi2+R_of)))\n",

      "print round(R_out/1e6,1),\"= R_out (Mohm)\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "29.5 = R_in (ohm)\n",

        "-3.44 = I_o/I_S (A/A)\n",

        "18.1 = R_out (Mohm)\n"

       ]

      }

     ],

     "prompt_number": 29

    }

   ],

   "metadata": {}

  }

 ]

}