summaryrefslogtreecommitdiff
path: root/Electronic_Circuits_by_Dr._Sanjay_Sharma/Chapter4.ipynb
diff options
context:
space:
mode:
authorThomas Stephen Lee2015-08-28 16:53:23 +0530
committerThomas Stephen Lee2015-08-28 16:53:23 +0530
commit4a1f703f1c1808d390ebf80e80659fe161f69fab (patch)
tree31b43ae8895599f2d13cf19395d84164463615d9 /Electronic_Circuits_by_Dr._Sanjay_Sharma/Chapter4.ipynb
parent9d260e6fae7328d816a514130b691fbd0e9ef81d (diff)
downloadPython-Textbook-Companions-4a1f703f1c1808d390ebf80e80659fe161f69fab.tar.gz
Python-Textbook-Companions-4a1f703f1c1808d390ebf80e80659fe161f69fab.tar.bz2
Python-Textbook-Companions-4a1f703f1c1808d390ebf80e80659fe161f69fab.zip
add books
Diffstat (limited to 'Electronic_Circuits_by_Dr._Sanjay_Sharma/Chapter4.ipynb')
-rw-r--r--Electronic_Circuits_by_Dr._Sanjay_Sharma/Chapter4.ipynb924
1 files changed, 924 insertions, 0 deletions
diff --git a/Electronic_Circuits_by_Dr._Sanjay_Sharma/Chapter4.ipynb b/Electronic_Circuits_by_Dr._Sanjay_Sharma/Chapter4.ipynb
new file mode 100644
index 00000000..38d22a7c
--- /dev/null
+++ b/Electronic_Circuits_by_Dr._Sanjay_Sharma/Chapter4.ipynb
@@ -0,0 +1,924 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 4 - Differential amplifiers"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 4.1 - page 317"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data\n",
+ "V_CC= 10 # in volt\n",
+ "V_EE= -10 # in volt\n",
+ "I= 1 # in mA\n",
+ "I=I*10**-3 # in A\n",
+ "R_C= 10 # in kohm\n",
+ "R_C=R_C*10**3 # in kohm\n",
+ "V_BE=0.7 # in volt\n",
+ "\n",
+ "i_C1= I/2 # in A\n",
+ "i_C2= i_C1 # in A\n",
+ "print \"Value of i_C1 = %0.2f mA\" %(i_C1*10**3)\n",
+ "\n",
+ "V_C1= V_CC-i_C1*R_C # in V\n",
+ "# For V_cm=0 volt\n",
+ "V_E= -0.7 # in volt\n",
+ "V_CE1= V_C1-V_E # in volt\n",
+ "print \"For V_cm =0, The value of V_CE1 = %0.2f Volt\" %(V_CE1)\n",
+ "\n",
+ "# For V_cm= -5 volt\n",
+ "V_cm= -5 # in V\n",
+ "V_B= V_cm # in V\n",
+ "# From V_BE= V_B-V_E\n",
+ "V_E= V_B-V_BE # in volt\n",
+ "V_CE1= V_C1-V_E # in volt\n",
+ "print \"For V_cm =-5V, The value of V_CE1 = %0.2f Volt\" %V_CE1\n",
+ "\n",
+ "# For V_cm= 5 volt\n",
+ "V_cm= 5 # in V\n",
+ "V_B= V_cm # in V\n",
+ "V_E= V_B-V_BE # in volt\n",
+ "V_CE1= V_C1-V_E # in volt\n",
+ "print \"For V_cm =5V, The value of V_CE1 = %0.2f Volt\" %V_CE1"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Value of i_C1 = 0.50 mA\n",
+ "For V_cm =0, The value of V_CE1 = 5.70 Volt\n",
+ "For V_cm =-5V, The value of V_CE1 = 10.70 Volt\n",
+ "For V_cm =5V, The value of V_CE1 = 0.70 Volt\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 4.2 - page 338"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from numpy import sqrt\n",
+ "# Given data\n",
+ "V_DD= 1.5 # in V\n",
+ "V_SS= V_DD # in V\n",
+ "KnWL= 4 # in mA/V**2\n",
+ "KnWL=KnWL*10**-3 # in A/V**2\n",
+ "Vt= 0.5 # in V\n",
+ "I=0.4 # in mA\n",
+ "I=I*10**-3 #in A\n",
+ "R_D= 2.5 # in k\u03a9\n",
+ "R_D= R_D*10**3 # in \u03a9\n",
+ "\n",
+ "# Part (a)\n",
+ "print \"Part (a)\"\n",
+ "V_OV= sqrt(I/KnWL) # in V\n",
+ "V_GS= V_OV+Vt # in V\n",
+ "print \"Value of V_OV = %0.2f Volt\" %V_OV\n",
+ "print \"Value of V_GS = %0.2f Volt\" %V_GS\n",
+ "\n",
+ "# Part (b)\n",
+ "print \"Part (b)\"\n",
+ "V_CM= 0 # in volt\n",
+ "V_S= -V_GS # in volt\n",
+ "print \"Value of V_S = %0.2f Volt\" %V_S\n",
+ "I=0.4 # in mw\n",
+ "i_D1= I/2 # in mA\n",
+ "print \"Value of i_D1 = %0.2f mA\" %i_D1\n",
+ "i_D1=i_D1*10**-3 # in A\n",
+ "V_D1= V_DD-i_D1*R_D # in V\n",
+ "V_D2=V_D1 # in V\n",
+ "print \"Value of V_D1 = %0.2f Volt\" %V_D1\n",
+ "print \"Value of V_D2 = %0.2f Volt\" %V_D2\n",
+ "\n",
+ "\n",
+ "# Part (c)\n",
+ "print \"Part (c)\"\n",
+ "V_CM=1 # in V\n",
+ "V_GS= 0.82 # in V\n",
+ "V_G= 1 # in V\n",
+ "V_S= V_G-V_GS # in V\n",
+ "print \"Value of V_S = %0.2f Volt\" %V_S\n",
+ "i_D1= I/2 # in mA\n",
+ "print \"Value of i_D1 = %0.2f mA\" %i_D1\n",
+ "i_D1=i_D1*10**-3 # in A\n",
+ "V_D1= V_DD-i_D1*R_D # in V\n",
+ "V_D2=V_D1 # in V\n",
+ "print \"Value of V_D1 = %0.2f Volt\" %V_D1\n",
+ "print \"Value of V_D2 = %0.2f Volt\" %V_D2\n",
+ "\n",
+ "# Part (d)\n",
+ "print \"Part (d)\"\n",
+ "V_CM_max= Vt+V_DD-i_D1*R_D\n",
+ "print \"Highest value of V_CM = %0.2f Volt\" %V_CM_max\n",
+ "\n",
+ "# Part (e)\n",
+ "V_S= 0.4 # in V\n",
+ "print \"Part (e)\"\n",
+ "V_CM_min= -V_SS+V_S+Vt+V_OV # in V\n",
+ "print \"Lowest value of V_CM = %0.2f Volt \" %V_CM_min\n",
+ "V_Smin= V_CM_min-V_GS # in volt\n",
+ "print \"Lowest value of V_S = %0.2f Volt\" %V_Smin"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Part (a)\n",
+ "Value of V_OV = 0.32 Volt\n",
+ "Value of V_GS = 0.82 Volt\n",
+ "Part (b)\n",
+ "Value of V_S = -0.82 Volt\n",
+ "Value of i_D1 = 0.20 mA\n",
+ "Value of V_D1 = 1.00 Volt\n",
+ "Value of V_D2 = 1.00 Volt\n",
+ "Part (c)\n",
+ "Value of V_S = 0.18 Volt\n",
+ "Value of i_D1 = 0.20 mA\n",
+ "Value of V_D1 = 1.00 Volt\n",
+ "Value of V_D2 = 1.00 Volt\n",
+ "Part (d)\n",
+ "Highest value of V_CM = 1.50 Volt\n",
+ "Part (e)\n",
+ "Lowest value of V_CM = -0.28 Volt \n",
+ "Lowest value of V_S = -1.10 Volt\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 4.3 - page 341"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data\n",
+ "I= 0.4 # in mA\n",
+ "unCox= 0.2 # in mA/V**2\n",
+ "i_D= I/2 # in mA\n",
+ "V_OV1= 0.2 # in V\n",
+ "V_OV2= 0.3 # in V\n",
+ "V_OV3= 0.4 # in V\n",
+ "WbyL1= 2*i_D/(unCox*V_OV1**2) \n",
+ "gm1= I/V_OV1 # in mA/V\n",
+ "WbyL2= 2*i_D/(unCox*V_OV2**2) \n",
+ "gm2= I/V_OV2 # in mA/V\n",
+ "WbyL3= 2*i_D/(unCox*V_OV3**2) \n",
+ "gm3= I/V_OV3 # in mA/V\n",
+ "print \"Vov (in V) \",V_OV1,\" \",V_OV2,\" \",V_OV3\n",
+ "print \"W/L \",WbyL1,\" \",round(WbyL2,1),\" \",WbyL3\n",
+ "print \"gm(in mA/V) \",gm1,\" \",round(gm2,2),\" \",gm3"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Vov (in V) 0.2 0.3 0.4\n",
+ "W/L 50.0 22.2 12.5\n",
+ "gm(in mA/V) 2.0 1.33 1.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 4.4 - page 341"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data\n",
+ "V_A= 20 # in V\n",
+ "R_D= 5 # in k\u03a9\n",
+ "R_D= R_D*10**3 # in \u03a9\n",
+ "I= 0.8 # in mA\n",
+ "I=I*10**-3 # in A\n",
+ "i_D= I/2 # in A\n",
+ "unCox= 0.2 # mA/V**2\n",
+ "unCox= unCox*10**-3 # in A/V**2\n",
+ "WbyL= 100 \n",
+ "# Formula i_D= 1/2*unCox*WbyL*V_OV**2\n",
+ "V_OV= sqrt(2*i_D/(unCox*WbyL)) # in V\n",
+ "print \"The value of V_OV = %0.2f Volts\" %V_OV\n",
+ "gm= I/V_OV # in A/V \n",
+ "print \"The value of gm = %0.f mA/V\" %(gm*10**3)\n",
+ "r_o= V_A/i_D # in \u03a9\n",
+ "print \"The value of r_o = %0.f k\u03a9\" %(r_o*10**-3)\n",
+ "# Ad= v_o/v_id = gm*(R_D || r_o)\n",
+ "Ad= gm*(R_D*r_o/(R_D+r_o)) # in V/V\n",
+ "print \"Differential gain = %0.1f V/V \" %Ad"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of V_OV = 0.20 Volts\n",
+ "The value of gm = 4 mA/V\n",
+ "The value of r_o = 50 k\u03a9\n",
+ "Differential gain = 18.2 V/V \n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 4.5 - page 342"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from numpy import log10\n",
+ "# Given data\n",
+ "R_D= 5 # in k\u03a9\n",
+ "R_D= R_D*10**3 # in \u03a9\n",
+ "R_SS= 25 # in k\u03a9\n",
+ "R_SS= R_SS*10**3 # in \u03a9\n",
+ "I= 0.8 # in mA\n",
+ "I=I*10**-3 # in A\n",
+ "i_D= I/2 # in A\n",
+ "unCox= 0.2 # mA/V**2\n",
+ "unCox= unCox*10**-3 # in A/V**2\n",
+ "WbyL= 100 \n",
+ "# Formula i_D= 1/2*unCox*WbyL*V_OV**2\n",
+ "V_OV= sqrt(2*i_D/(unCox*WbyL)) # in V\n",
+ "gm= i_D/V_OV # in A/V \n",
+ "\n",
+ "# Part (a)\n",
+ "Ad= 1/2*gm*R_D # in V/V\n",
+ "print \"Differential gain = %0.f V/V\" %(Ad)\n",
+ "Acm= -R_D/(2*R_SS) # in V/V\n",
+ "print \"Common mode gain = %0.1f V/V\" %Acm\n",
+ "CMRR= abs(Ad)/abs(Acm) \n",
+ "CMRRindB= round(20*log10(CMRR)) # in dB\n",
+ "print \"Common mode rejection ratio = %0.f dB\" %CMRRindB\n",
+ "\n",
+ "\n",
+ "# Part (b)\n",
+ "print \"Part (b) when output is taken differentially\"\n",
+ "Ad= gm*R_D # in V/V\n",
+ "print \"Differential gain = %0.f V/V\" %Ad\n",
+ "Acm= 0 \n",
+ "print \"Common mode gain = %0.1f V/V \"%Acm\n",
+ "CMRRindB= 20*log10(Ad/Acm) # in dB\n",
+ "print \"Common mode rejection ratio = %0.f dB\" %CMRRindB\n",
+ "\n",
+ "\n",
+ "# Part (c)\n",
+ "print \"Part (c) when output is taken differentially but the drain resistance have a 1% mismatch.\"\n",
+ "Ad= gm*R_D # in V/V\n",
+ "print \"Differential gain = %0.f V/V\" %Ad\n",
+ "# delta_R_D= 1% of R_D\n",
+ "delta_R_D= R_D*1.0/100 # in \u03a9 \n",
+ "Acm= R_D/(2*R_SS)*delta_R_D/R_D # in V/V\n",
+ "print \"Common mode gain = %0.3f V/V\" %Acm\n",
+ "CMRRindB= 20*log10(abs(Ad)/abs(Acm)) # in dB\n",
+ "print \"Common mode rejection ratio = %0.1f dB\" %CMRRindB\n",
+ "\n",
+ "# Note: In the book, there is putting wrong value of Ad (20 at place of 10)\n",
+ "#to evaluate the value of CMRR in dB in part(c) , So the answer of CMRR in dB of Part (c) is wrong"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Differential gain = 5 V/V\n",
+ "Common mode gain = -0.1 V/V\n",
+ "Common mode rejection ratio = 34 dB\n",
+ "Part (b) when output is taken differentially\n",
+ "Differential gain = 10 V/V\n",
+ "Common mode gain = 0.0 V/V \n",
+ "Common mode rejection ratio = inf dB\n",
+ "Part (c) when output is taken differentially but the drain resistance have a 1% mismatch.\n",
+ "Differential gain = 10 V/V\n",
+ "Common mode gain = 0.001 V/V\n",
+ "Common mode rejection ratio = 80.0 dB\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 4.6 - page 343"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data (From Exa 4.4)\n",
+ "R_D= 5 # in k\u03a9\n",
+ "R_D= R_D*10**3 # in \u03a9\n",
+ "R_SS= 25 # in k\u03a9\n",
+ "R_SS= R_SS*10**3 # in \u03a9\n",
+ "I= 0.8 # in mA\n",
+ "I=I*10**-3 # in A\n",
+ "i_D= I/2 # in A\n",
+ "unCox= 0.2 # mA/V**2\n",
+ "unCox= unCox*10**-3 # in A/V**2\n",
+ "WbyL= 100 \n",
+ "# Formula i_D= 1/2*unCox*WbyL*V_OV**2\n",
+ "V_OV= sqrt(2*i_D/(unCox*WbyL)) # in V\n",
+ "gm= i_D/V_OV # in A/V \n",
+ "# gm mismatch have a negligible effect on Ad\n",
+ "Ad= gm*R_D # in V/V(approx) \n",
+ "# delta_gm= 1% of gm\n",
+ "delta_gm = gm*1/100 # in A/V\n",
+ "Acm= R_D/(2*R_SS)*delta_gm/gm \n",
+ "CMRRindB= 20*log10(Ad/Acm) \n",
+ "print \"CMRR is %0.f dB\"%CMRRindB"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "CMRR is 80 dB\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 4.7 - page 344"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data \n",
+ "V_CM= 0 \n",
+ "V_BE= -0.7 # in volt\n",
+ "v_E= V_CM-V_BE # in volt\n",
+ "print \"Value of v_E = %0.1f Volts\" %v_E\n",
+ "\n",
+ "I_E= (5-0.7)/10**3 # in A\n",
+ "v_B1= 0.5 # in V\n",
+ "v_B2= 0 # in V\n",
+ "# Due to Q1 is off therefore\n",
+ "v_C1= -5 # in V\n",
+ "v_C2= I_E*10**3-5 # in V\n",
+ "print \"Value of v_C1 = %0.1f Volts\" %v_C1\n",
+ "print \"Value of v_C2 = %0.1f Volts\" %v_C2"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Value of v_E = 0.7 Volts\n",
+ "Value of v_C1 = -5.0 Volts\n",
+ "Value of v_C2 = -0.7 Volts\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 4.8 - page 345"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from numpy import log\n",
+ "# Given data \n",
+ "iE1_by_I= 0.99 # as it is given that iE1= 0.99 *I\n",
+ "VT= 0.025 # in volt\n",
+ "# Formula iE1= I/(1+%e**(-vid/VT))\n",
+ "# %e**(-vid/VT)= 1/iE1_by_I-1\n",
+ "vid= log( 1/iE1_by_I-1)*(-VT) # in volt\n",
+ "print \"Input differential signal = %0.1f mV\" %round(vid*10**3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Input differential signal = 115.0 mV\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 4.9 - page 345"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data \n",
+ "Beta= 100 \n",
+ "\n",
+ "# Part (a)\n",
+ "RE= 150 # in \u03a9\n",
+ "VT= 25 # in mV\n",
+ "VT= VT*10**-3 # in V\n",
+ "IE= 0.5 # in mA\n",
+ "IE=IE*10**-3 # in A\n",
+ "re1= VT/IE #in \u03a9\n",
+ "R_id= 2*(Beta+1)*(re1+RE) # in \u03a9\n",
+ "R_id= round(R_id*10**-3) # in k\u03a9\n",
+ "print \"(a) The input differential resistance = %0.1f k\u03a9\" %R_id\n",
+ "\n",
+ "# Part (b)\n",
+ "RC=10 #in k\u03a9\n",
+ "RC=RC*10**3 #in \u03a9\n",
+ "Rsig= 5+5 # in k\u03a9\n",
+ "VoltageGain1= R_id/(Rsig+R_id) #voltage gain from the signal source to the base of Q1 and Q2 in V/V\n",
+ "VoltageGain2= 2*RC/(2*(re1+RE)) # voltage gain from the bases to the output in V/V\n",
+ "Ad= VoltageGain1*VoltageGain2 #in V/V\n",
+ "print \"(b) The overall differential voltage gain = %0.1f V/V\" %Ad\n",
+ "\n",
+ "# Part (c)\n",
+ "delta_RC= 0.02*RC \n",
+ "R_EE= 200 #in k\u03a9\n",
+ "R_EE=R_EE*10**3 #in \u03a9\n",
+ "Acm= RC/(2*R_EE)*delta_RC/RC #in V/V\n",
+ "print \"(c) Common mode gain = %0.e V/V\" %Acm\n",
+ "\n",
+ "# Part (d)\n",
+ "CMRRindB= 20*log10(Ad/Acm) # in dB\n",
+ "print \"(d) CMRR = %.f dB\" %CMRRindB\n",
+ "\n",
+ "# Part (e)\n",
+ "V_A= 100 # in V\n",
+ "r_o= V_A/(IE) # in \u03a9\n",
+ "# Ricm= (Beta+1)*(R_EE || r_o/2)\n",
+ "Ricm= (Beta+1)*(R_EE*(r_o/2)/(R_EE+(r_o/2))) \n",
+ "print \"(e) Input common mode resistance = %0.1f M\u03a9\" %(Ricm*10**-6)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a) The input differential resistance = 40.0 k\u03a9\n",
+ "(b) The overall differential voltage gain = 40.0 V/V\n",
+ "(c) Common mode gain = 5e-04 V/V\n",
+ "(d) CMRR = 98 dB\n",
+ "(e) Input common mode resistance = 6.7 M\u03a9\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 4.10 - page 347"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data \n",
+ "delta_RDbyRD= 2/100 \n",
+ "delta_WLbyWL= 2/100 \n",
+ "delta_Vt= 2 #in mV\n",
+ "delta_Vt= delta_Vt*10**-3 # in V\n",
+ "#(From Exa 4.4)\n",
+ "V_A= 20 # in V\n",
+ "R_D= 5 # in k\u03a9\n",
+ "R_D= R_D*10**3 # in \u03a9\n",
+ "I= 0.8 # in mA\n",
+ "I=I*10**-3 # in A\n",
+ "i_D= I/2 # in A\n",
+ "unCox= 0.2 # mA/V**2\n",
+ "unCox= unCox*10**-3 # in A/V**2\n",
+ "WbyL= 100 \n",
+ "# Formula i_D= 1/2*unCox*WbyL*V_OV**2\n",
+ "V_OV= sqrt(2*i_D/(unCox*WbyL)) # in V\n",
+ "V_OS1= V_OV/2*delta_RDbyRD # in V\n",
+ "\n",
+ "# V_OS due to W/L ratio\n",
+ "V_OS2= V_OV/2*delta_WLbyWL # in V\n",
+ "\n",
+ "# V_OS due to threshold voltage\n",
+ "V_OS3= delta_Vt # in V\n",
+ "# Total offset voltage\n",
+ "V_OS= sqrt(V_OS1**2+V_OS2**2+V_OS3**2) # in V\n",
+ "V_OS= V_OS*10**3 # in mV\n",
+ "print \"Total offset voltage = %0.1f mV\" %V_OS"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Total offset voltage = 3.5 mV\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 4.11 - page 348"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data \n",
+ "WLn= 100 \n",
+ "WLp= 200 \n",
+ "unCox= 0.2 # mA/V**2\n",
+ "unCox=unCox*10**-3 #in A/V**2\n",
+ "RSS= 25 # in k\u03a9\n",
+ "RSS= RSS*10**3 # in \u03a9\n",
+ "I=0.8 # in mA\n",
+ "I=I*10**-3 #in A\n",
+ "V_A= 20 # in V\n",
+ "i_D= I/2 # in A\n",
+ "# Formula i_D= 1/2*unCox*WLn*V_OV**2\n",
+ "V_OV= sqrt(2*i_D/(unCox*WLn)) # in V\n",
+ "gm= I/V_OV # in A/V\n",
+ "print \"Value of Gm = %0.1f mA/V\" %(gm*10**3)\n",
+ "ro2= V_A/(I/2) # in ohm\n",
+ "ro4= ro2 # in ohm\n",
+ "Ro= ro2*ro4/(ro2+ro4) # in ohm\n",
+ "print \"Value of Ro = %0.1f k\u03a9\" %(Ro*10**-3)\n",
+ "Ad= gm*Ro # in V/V\n",
+ "print \"Value of Ad = %0.1f V/V\" %Ad\n",
+ "# Finding the value of gm3\n",
+ "upCox= 0.1 # mA/V**2\n",
+ "upCox=upCox*10**-3 #in A/V**2\n",
+ "# Formula i_D= 1/2*upCox*WLp*V_OV**2\n",
+ "V_OV= sqrt(2*i_D/(upCox*WLp)) # in V\n",
+ "gm3= I/V_OV # in A/V\n",
+ "Acm= 1/(2*gm3*RSS) #in V/V\n",
+ "print \"Value of |Acm| = %0.3f V/V\" %(abs(Acm))\n",
+ "CMRRindB= 20*log10(abs(Ad)/abs(Acm)) #in dB\n",
+ "print \"CMRR = %0.f dB\" %(round(CMRRindB))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Value of Gm = 4.0 mA/V\n",
+ "Value of Ro = 25.0 k\u03a9\n",
+ "Value of Ad = 100.0 V/V\n",
+ "Value of |Acm| = 0.005 V/V\n",
+ "CMRR = 86 dB\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 4.12 - page 349"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data \n",
+ "I=0.8 # in mA\n",
+ "I=I*10**-3 #in A\n",
+ "V_A= 100 # in V\n",
+ "Beta=160 \n",
+ "VT=25 # in mV\n",
+ "VT= VT*10**-3 #in V\n",
+ "gm= (I/2)/VT # in A/V\n",
+ "Gm= gm # Short circuit trnsconductance in mA/V\n",
+ "print \"The value of Gm = %0.1f mA/V\" %(Gm*10**3)\n",
+ "ro2= V_A/(I/2) # in ohm\n",
+ "ro4= ro2 # in ohm\n",
+ "Ro= ro2*ro4/(ro2+ro4) # in ohm\n",
+ "print \"The value of Ro = %0.1f k\u03a9\" %(Ro*10**-3)\n",
+ "Ad= Gm*Ro # in V/V\n",
+ "print \"Value of Ad = %0.1f V/V\" %Ad\n",
+ "r_pi= Beta/gm #in \u03a9\n",
+ "Rid= 2*r_pi # in \u03a9\n",
+ "print \"The value of Rid = %0.1f k\u03a9\" %(Rid*10**-3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of Gm = 16.0 mA/V\n",
+ "The value of Ro = 125.0 k\u03a9\n",
+ "Value of Ad = 2000.0 V/V\n",
+ "The value of Rid = 20.0 k\u03a9\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 4.13 - page 349"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data \n",
+ "Vtp= -0.8 # in V\n",
+ "KpWL= 3.5 # in mA/V**2\n",
+ "I=0.7 # in mA\n",
+ "I=I*10**-3 # in A\n",
+ "R_D= 2 # in k\u03a9\n",
+ "R_D=R_D*10**3 # in \u03a9\n",
+ "KpWL=KpWL*10**-3 #in A/V**2\n",
+ "v_G1= 0 # in V\n",
+ "v_G2=v_G1 # in V\n",
+ "VSS= 2.5 # in V\n",
+ "VDD=VSS # in V\n",
+ "VCS= 0.5 # in V\n",
+ "print \"Part (a)\"\n",
+ "V_OV= -sqrt(I/KpWL) # in V\n",
+ "print \"The value of V_OV = %0.2f Volts\" %V_OV\n",
+ "V_GS= V_OV+Vtp # in V\n",
+ "print \"The value of V_GS = %0.2f Volts\" %V_GS\n",
+ "V_G= 0 # as gate is connected ground\n",
+ "v_S1= V_G-V_GS # in V\n",
+ "v_S2= v_S1 # in V\n",
+ "print \"The value of v_S1 = %0.2f Volts\" %v_S1\n",
+ "v_D1= I/2*R_D-VDD # in V\n",
+ "v_D2=v_D1 # in V\n",
+ "print \"The value of v_D1 = %0.1f Volts\" %v_D1\n",
+ "print \"The value of v_D2 = %0.1f Volts\" %v_D2\n",
+ "\n",
+ "print \"Part (b)\"\n",
+ "V_CMmin= I*R_D/2-VDD+Vtp # in V\n",
+ "V_CMmax= VSS-VCS+Vtp+V_OV # in V\n",
+ "print \"The value of V_CMmin = %0.1f Volts\" %V_CMmin\n",
+ "print \"The value of V_CMmax = %0.2f Volts\" %V_CMmax"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Part (a)\n",
+ "The value of V_OV = -0.45 Volts\n",
+ "The value of V_GS = -1.25 Volts\n",
+ "The value of v_S1 = 1.25 Volts\n",
+ "The value of v_D1 = -1.8 Volts\n",
+ "The value of v_D2 = -1.8 Volts\n",
+ "Part (b)\n",
+ "The value of V_CMmin = -2.6 Volts\n",
+ "The value of V_CMmax = 0.75 Volts\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 4.14 - page 351"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data \n",
+ "V_OV= 0.2 # in V\n",
+ "gm=1 # in mA/V\n",
+ "gm=gm*10**-3 # in A/V\n",
+ "Vt=0.8 # in V\n",
+ "unCox= 90 # in \u00b5A/V**2\n",
+ "unCox=unCox*10**-6 # in A/V**2\n",
+ "# gm= I/V_OV\n",
+ "I= gm*V_OV # in A\n",
+ "print \"Bias current = %0.1f mA\" %(I*10**3)\n",
+ "I_D= I/2 # in A\n",
+ "# Formula I_D= 1/2*unCox*WLn*V_OV**2\n",
+ "WbyL= 2*I_D/(unCox*V_OV**2) \n",
+ "print \"W/L ratio is %0.1f \"%WbyL"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Bias current = 0.2 mA\n",
+ "W/L ratio is 55.6 \n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 4.15 - page 351"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data \n",
+ "I=0.5 # in mA\n",
+ "I=I*10**-3 # in A\n",
+ "WbyL= 50 \n",
+ "unCox= 250 # in \u00b5A/V**2\n",
+ "unCox=unCox*10**-6 # in A/V**2\n",
+ "V_A= 10 # in V\n",
+ "R_D= 4 #in k\u03a9\n",
+ "R_D= R_D*10**3 #in \u03a9\n",
+ "V_OV= sqrt(I/(WbyL*unCox)) #in V\n",
+ "print \"The value of V_OV = %0.2f V \" %V_OV\n",
+ "gm= I/V_OV # in A/V\n",
+ "print \"The value of gm = %0.2f mA/V\" %(gm*10**3)\n",
+ "I_D=I/2 # in A\n",
+ "ro= V_A/I_D # in \u03a9\n",
+ "print \"The value of ro = %0.2f k\u03a9\" %(ro*10**-3)\n",
+ "Ad= gm*(R_D*ro/(R_D+ro)) # in V/V\n",
+ "print \"The value of Ad = %0.2f V/V \" %Ad"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of V_OV = 0.20 V \n",
+ "The value of gm = 2.50 mA/V\n",
+ "The value of ro = 40.00 k\u03a9\n",
+ "The value of Ad = 9.09 V/V \n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 4.16 - page 352"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data \n",
+ "I=1 # in mA\n",
+ "I=I*10**-3 # in A\n",
+ "i_C=1 # in mA\n",
+ "i_C=i_C*10**-3 # in A\n",
+ "V_CC= 5 # in V\n",
+ "V_CM= -2 # in V\n",
+ "V_BE= 0.7 # in V\n",
+ "R_C= 3 # in k\u03a9\n",
+ "R_C= R_C*10**3 # in \u03a9\n",
+ "Alpha=1 \n",
+ "Beta=100 \n",
+ "V_B= 1 # in V\n",
+ "i_C1= Alpha*I # in A\n",
+ "i_C2=0 # A\n",
+ "v_E= V_B-V_BE # in V\n",
+ "print \"Emitters voltage = %0.2f Volt\" %v_E,\n",
+ "v_C1= V_CC-i_C1*R_C # in V\n",
+ "v_C2= V_CC-i_C2*R_C # in V\n",
+ "print \"Output voltage is\",v_C1,\"V &\",v_C2,\"V\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Emitters voltage = 0.30 Volt Output voltage is 2.0 V & 5 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}