summaryrefslogtreecommitdiff
path: root/Electronic_Circuits_by_P._Raja/Chapter2.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Electronic_Circuits_by_P._Raja/Chapter2.ipynb')
-rwxr-xr-xElectronic_Circuits_by_P._Raja/Chapter2.ipynb1179
1 files changed, 1179 insertions, 0 deletions
diff --git a/Electronic_Circuits_by_P._Raja/Chapter2.ipynb b/Electronic_Circuits_by_P._Raja/Chapter2.ipynb
new file mode 100755
index 00000000..3abf271f
--- /dev/null
+++ b/Electronic_Circuits_by_P._Raja/Chapter2.ipynb
@@ -0,0 +1,1179 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 2 - Metal oxide semiconductor field effect transistor(MOSFET)"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 2.1 - page 75"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data \n",
+ "V_S= 0 # As source is connected to ground\n",
+ "V_G= 1.5 # in V\n",
+ "V_D= 0.5 # in V\n",
+ "Vt= 0.7 # in V\n",
+ "# Part(a) V_D= 0.5 # in V\n",
+ "V_D= 0.5 # in V\n",
+ "V_DS= V_D-V_S # in V\n",
+ "V_GS= V_G-V_S # in V\n",
+ "if V_GS < Vt:\n",
+ " print \"At V_D = 0.5 , the device is in cut off region\"\n",
+ "elif V_DS<= (V_GS-Vt):\n",
+ " print \"At V_D = 0.5 , the device is in triode region\" \n",
+ "else:\n",
+ " print \"At V_D = 0.5 , the device is in saturation region\"\n",
+ "\n",
+ "# Part(b) V_D= 0.9 # in V\n",
+ "V_D= 0.9 # in V\n",
+ "V_DS= V_D-V_S # in V\n",
+ "V_GS= V_G-V_S # in V\n",
+ "if V_GS < Vt:\n",
+ " print \"At V_D = 0.9 , the device is in cut off region\"\n",
+ "elif V_DS<= (V_GS-Vt):\n",
+ " print \"At V_D = 0.9 , the device is in triode region\"\n",
+ "else:\n",
+ " print \"At V_D = 0.9 , the device is in saturation region\" \n",
+ "\n",
+ "\n",
+ "# Part(c) V_D= 3 # in V\n",
+ "V_D= 3 # in V\n",
+ "V_DS= V_D-V_S # in V\n",
+ "V_GS= V_G-V_S # in V\n",
+ "if V_GS < Vt:\n",
+ " print \"At V_D = 3 , the device is in cut off region\"\n",
+ "elif V_DS<= (V_GS-Vt):\n",
+ " print \"At V_D = 3 , the device is in triode region\"\n",
+ "else:\n",
+ " print \"At V_D = 3 , the device is in saturation region\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "At V_D = 0.5 , the device is in triode region\n",
+ "At V_D = 0.9 , the device is in saturation region\n",
+ "At V_D = 3 , the device is in saturation region\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 2.2 - page 77"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data \n",
+ "unCox= 100 # in \u00b5A/V**2\n",
+ "unCox= unCox*10**-6 # in A/V**2\n",
+ "L= 1 #in \u00b5m\n",
+ "L= L*10**-6 # in m\n",
+ "W=10 # in \u00b5m\n",
+ "W=W*10**-6 # in m\n",
+ "V_GS= 1.5 # in V\n",
+ "Vt= 0.7 # in V\n",
+ "# For V_DS= 0.5 V\n",
+ "V_DS= 0.5 # in V\n",
+ "if V_DS<= (V_GS-Vt):\n",
+ " I_D= unCox*W/L*((V_GS-Vt)*V_DS-V_DS**2/2)\n",
+ " print \"The device is in triode region. SO the drain current in the triode region = %0.f \u00b5A\" %(I_D*10**6)\n",
+ "else:\n",
+ " I_D= unCox*W/(2*L)*(V_GS-VT)**2\n",
+ " print \"The device is in saturation region. SO the drain current in the saturation region = %0.1f \u00b5A\" %(I_D*10**6)\n",
+ "\n",
+ "# For V_DS= 0.9 V\n",
+ "V_DS= 0.9 # in V\n",
+ "if V_DS<= (V_GS-Vt):\n",
+ " I_D= unCox*W/L*((V_GS-Vt)*V_DS-V_DS**2/2)\n",
+ " print \"The device is in triode region. So the drain current in the triode region = %0.1f \u00b5A\" %(I_D*10**6)\n",
+ "else:\n",
+ " I_D= unCox*W/(2*L)*(V_GS-Vt)**2\n",
+ " print \"The device is in saturation region. So drain current in the saturation region = %0.f \u00b5A\" %(I_D*10**6)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The device is in triode region. SO the drain current in the triode region = 275 \u00b5A\n",
+ "The device is in saturation region. So drain current in the saturation region = 320 \u00b5A\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 2.3 - page 78"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data \n",
+ "Vt= 0.7 # in V\n",
+ "ID = 100 # in \u00b5A\n",
+ "V_GS= 1.2 # in V\n",
+ "V_DS= 1.2 # in V\n",
+ "\n",
+ "# Let assume \u00b5n*Cox*W/(2*L) = K\n",
+ "# For triode region\n",
+ "if V_DS<= (V_GS-Vt):\n",
+ " #triode region\n",
+ " K = ID*10**-6/(V_GS-Vt)**2\n",
+ " \n",
+ "else:\n",
+ " # saturation region\n",
+ " K = ID*10**-6/(V_GS-Vt)**2\n",
+ "\n",
+ "V_DS= 3 # inV\n",
+ "V_GS = 1.5 # in V\n",
+ "I_D= K*(V_GS-Vt)**2 # in A\n",
+ "I_D*=10**6 # in \u00b5A\n",
+ "print \"Value of ID = %0.1f \u00b5A\" %I_D\n",
+ "# Drain to source resistance\n",
+ "V_GS = 3.2 # in V\n",
+ "r_DS = 1/(2*K*(V_GS-Vt))\n",
+ "print \"Drain to source resistance, rDS = %0.1f ohm\" %r_DS"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Value of ID = 256.0 \u00b5A\n",
+ "Drain to source resistance, rDS = 500.0 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 21
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 2.4 - page 82"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from numpy import sqrt\n",
+ "# Given data \n",
+ "I_D= 0.4 # in mA\n",
+ "I_D=I_D*10**-3 # in A\n",
+ "Vt= 0.7 # in V\n",
+ "V_SS= -2.5 # in V\n",
+ "V_DD= 2.5 # in V\n",
+ "unCox= 100 # in \u00b5A/V**2\n",
+ "unCox= unCox*10**-6 # in A/V**2\n",
+ "W= 32 # in m\n",
+ "L= 1 # in m\n",
+ "# V_GS-Vt= V_OV\n",
+ "# I_D= unCox*W/(2*L)*(V_OV)**2\n",
+ "V_OV= sqrt(I_D/(unCox*W/(2*L))) # in V\n",
+ "V_GS= V_OV+Vt # in V\n",
+ "print \"The value of V_GS = %0.1f Volt\" %V_GS\n",
+ "V_G= 0 \n",
+ "# Formula V_GS= V_G-V_S\n",
+ "V_S= V_G-V_GS # in V\n",
+ "R_S= (V_S-V_SS)/I_D# in \u03a9\n",
+ "print \"The value of R_S = %0.2f k\u03a9\" %(R_S*10**-3)\n",
+ "V_D= 0.5 # in V\n",
+ "R_D= (V_DD-V_D)/I_D #in \u03a9\n",
+ "print \"The value of R_D = %0.1f k\u03a9\" %(R_D*10**-3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of V_GS = 1.2 Volt\n",
+ "The value of R_S = 3.25 k\u03a9\n",
+ "The value of R_D = 5.0 k\u03a9\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 2.5 - page 83"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from numpy import sqrt\n",
+ "# Given data \n",
+ "V_DD= 3 # in V\n",
+ "I_D= 80 # in \u00b5A\n",
+ "I_D=I_D*10**-6 # in A\n",
+ "Vt= 0.6 # in V\n",
+ "unCox= 200 # in \u00b5A/V**2\n",
+ "unCox= unCox*10**-6 # in A/V**2\n",
+ "L= 0.8 #in \u00b5m\n",
+ "L= L*10**-6 # in m\n",
+ "W=4 # in \u00b5m\n",
+ "W=W*10**-6 # in m\n",
+ "# V_GS-Vt= V_OV\n",
+ "# I_D= unCox*W/(2*L)*(V_OV)**2\n",
+ "V_OV= sqrt(I_D/(unCox*W/(2*L))) # in V\n",
+ "V_GS= V_OV+Vt # in V\n",
+ "V_D= 1 # in V\n",
+ "V_G= V_D # in V\n",
+ "R= (V_DD-V_D)/I_D # in \u03a9\n",
+ "print \"The value of R = %0.f k\u03a9\" %(R*10**-3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of R = 25 k\u03a9\n"
+ ]
+ }
+ ],
+ "prompt_number": 29
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 2.6 - page 84"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from numpy import sqrt\n",
+ "# Given data \n",
+ "V_DD= 10 # in V\n",
+ "I_D= 0.4 # in mA\n",
+ "I_D=I_D*10**-3 # in A\n",
+ "Vt= 2 # in V\n",
+ "unCox= 20 # in \u00b5A/V**2\n",
+ "unCox= unCox*10**-6 # in A/V**2\n",
+ "L= 10 #in \u00b5m\n",
+ "L= L*10**-6 # in m\n",
+ "W=100 # in \u00b5m\n",
+ "W=W*10**-6 # in m\n",
+ "V_S= 0 # in V as source is connected to ground\n",
+ "# I_D= unCox*W/(2*L)*(V_OV)**2\n",
+ "V_OV= sqrt(I_D/(unCox*W/(2*L))) # in V\n",
+ "V_GS= V_OV+Vt # in V\n",
+ "V_D= V_GS # in V\n",
+ "R= (V_DD-V_D)/I_D # in \u03a9\n",
+ "print \"The value of R = %0.2f k\u03a9\" %(R*10**-3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of R = 15.00 k\u03a9\n"
+ ]
+ }
+ ],
+ "prompt_number": 30
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 2.7 - page 85"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "# Given data \n",
+ "KnWbyL= 1 # in mA\n",
+ "KnWbyL=KnWbyL*10**-3 # in A\n",
+ "Vt= 1 # in V\n",
+ "V_DS= 0.1 # in V\n",
+ "V_D= V_DS # in V\n",
+ "V_GS= 5 # in V\n",
+ "V_DD= V_GS # in V\n",
+ "# Formula I_D= K'nW/L*[(V_GS-Vt)*V_DS-V_DS**2/2]\n",
+ "I_D= KnWbyL*((V_GS-Vt)*V_DS-V_DS**2/2) # in A\n",
+ "R_D= (V_DD-V_D)/I_D #in \u03a9\n",
+ "print \"The required value of R_D = %0.1f k\u03a9\" %(R_D*10**-3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The required value of R_D = 12.4 k\u03a9\n"
+ ]
+ }
+ ],
+ "prompt_number": 32
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 2.8 - page 86"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "# Given data \n",
+ "KnWbyL= 1 # in mA/V**2\n",
+ "KnWbyL=KnWbyL*10**-3 # in A/V**2\n",
+ "Vt= 1 # in V\n",
+ "V_DD= 10 # in V\n",
+ "R_D= 6 # in k\u03a9\n",
+ "R_D= R_D*10**3 # in \u03a9\n",
+ "R_S= 6 # in k\u03a9\n",
+ "R_S= R_S*10**3 # in \u03a9\n",
+ "R_G1= 10 # in M\u03a9\n",
+ "R_G1= R_G1*10**6 # in \u03a9\n",
+ "R_G2= 10 # in M\u03a9\n",
+ "R_G2= R_G2*10**6 # in \u03a9\n",
+ "V_G= V_DD*R_G2/(R_G1+R_G2) # in V\n",
+ "# V_S= R_S*I_D\n",
+ "# V_GS= V_G-V_S= V_G-R_S*I_D\n",
+ "# Formula I_D= K'nW/2*L*(V_GS-Vt)**2, Putting the value of V_GS, We get\n",
+ "# 18*I_D**2 -25*I_D +8= 0\n",
+ "# I_D= 0.89 mA or I_D= 0.5\n",
+ "I_D= 0.5 # in mA\n",
+ "I_D=I_D*10**-3 # in A\n",
+ "V_S= R_S*I_D # in V\n",
+ "V_GS= V_G-V_S # in V\n",
+ "V_D= V_DD-I_D*R_D # in V\n",
+ "print \"The value of I_D = %0.2f mA\" %(I_D*10**3)\n",
+ "print \"The value of V_S = %0.2f Volt\" %(V_S)\n",
+ "print \"The value of V_GS = %0.2f Volt\" %(V_GS)\n",
+ "print \"The value of V_D = %0.2f Volt\" %(V_D)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of I_D = 0.50 mA\n",
+ "The value of V_S = 3.00 Volt\n",
+ "The value of V_GS = 2.00 Volt\n",
+ "The value of V_D = 7.00 Volt\n"
+ ]
+ }
+ ],
+ "prompt_number": 33
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 2.9 - page 98"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "# Given data \n",
+ "R_D= 20 # in k\u03a9\n",
+ "R_D= R_D*10**3 # in \u03a9\n",
+ "R1= 30 # in k\u03a9\n",
+ "R1= R1*10**3 # in \u03a9\n",
+ "R2= 20 # in k\u03a9\n",
+ "R2= R2*10**3 # in \u03a9\n",
+ "V_DD= 5 # in V\n",
+ "Vtn= 1 # in V\n",
+ "Kn= 0.1 # in mA/V**2\n",
+ "Kn=Kn*10**-3 # in A/V**2\n",
+ "V_GS= R2*V_DD/(R1+R2) # in V\n",
+ "# I_D= 1/2*\u00b5nCox*W/L*(V_GS-Vtm)**2 \n",
+ "I_D = Kn*(V_GS-Vtn)**2 # in mA (As Kn= 1/2*\u00b5nCox*W/L)\n",
+ "V_DS= V_DD-I_D*R_D # in V\n",
+ "print \"The value of V_GS = %0.f Volt\" %(V_GS)\n",
+ "print \"The value of I_D = %0.2f mA\" %(I_D*10**3)\n",
+ "print \"The value of V_DS = %0.f Volt\" %(V_DS)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of V_GS = 2 Volt\n",
+ "The value of I_D = 0.10 mA\n",
+ "The value of V_DS = 3 Volt\n"
+ ]
+ }
+ ],
+ "prompt_number": 35
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 2.10 - page 99"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from numpy import sqrt\n",
+ "# Given data \n",
+ "V_DD= 15 # in V\n",
+ "Vt= 1 # in V\n",
+ "V_D= 10 # in V\n",
+ "V_S= 5 # in V\n",
+ "KnWbyL= 1 # in mA/V**2\n",
+ "KnWbyL=KnWbyL*10**-3 # in A/V**2\n",
+ "R_G1= 8 # in M\u03a9\n",
+ "R_G1= R_G1*10**6 # in \u03a9\n",
+ "I_D= 0.5 # in mA\n",
+ "I_D=I_D*10**-3 #in A\n",
+ "R_D= (V_DD-V_D)/I_D # in \u03a9\n",
+ "R_S= V_S/I_D # in \u03a9\n",
+ "# Formul I_D= 1/2*KnWbyL*(V_OV)**2\n",
+ "V_OV= sqrt(2*I_D/KnWbyL) # in V\n",
+ "# Formula V_OV= V_GS-Vt\n",
+ "V_GS= V_OV+Vt # in V\n",
+ "V_G= V_GS+V_S # in V\n",
+ "# Formul V_G= R_G2*V_DD/(R_G1+R_G2)\n",
+ "R_G2= R_G1*V_G/(V_DD-V_G) #in \u03a9\n",
+ "print \"The value of R_D = %0.1f k\u03a9\" %(R_D*10**-3)\n",
+ "print \"The value of R_S = %0.1f k\u03a9\" %(R_S*10**-3)\n",
+ "print \"The value of V_OV = %0.1f Volt\" %(V_OV)\n",
+ "print \"The value of V_GS = %0.1f Volt\" %V_GS\n",
+ "print \"The value of R_G2 = %0.1f M\u03a9\" %(R_G2*10**-6)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of R_D = 10.0 k\u03a9\n",
+ "The value of R_S = 10.0 k\u03a9\n",
+ "The value of V_OV = 1.0 Volt\n",
+ "The value of V_GS = 2.0 Volt\n",
+ "The value of R_G2 = 7.0 M\u03a9\n"
+ ]
+ }
+ ],
+ "prompt_number": 36
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 2.11 - page 110"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "# Given data \n",
+ "V_DD= 15 # in V\n",
+ "KnWbyL= 0.25 # in mA/V**2\n",
+ "KnWbyL=KnWbyL*10**-3 # in A/V**2\n",
+ "Vt= 1.5 # in V\n",
+ "V_A= 50 # in V\n",
+ "R_D= 10 # in k\u03a9\n",
+ "R_D= R_D*10**3 # in \u03a9\n",
+ "R_L= 10 # in k\u03a9\n",
+ "R_L= R_L*10**3 # in \u03a9\n",
+ "R_G= 10 # in M\u03a9\n",
+ "R_G= R_G*10**6 # in \u03a9\n",
+ "# I_D= 1/2*KnWbyL*(V_D-Vt)**2 , (V_GS= V_D, as dc gate current is zero) (i)\n",
+ "# V_D= V_DD- I_D*R_D (ii)\n",
+ "I_D= 1.06 # in mA\n",
+ "I_D = I_D*10**-3 # in A\n",
+ "V_D= V_DD- I_D*R_D # in V\n",
+ "V_GS=V_D # in V\n",
+ "# The coordinates of operating point \n",
+ "V_GSQ= V_D # in V\n",
+ "I_DQ= I_D*10**3 # in mA\n",
+ "print \"The coordinates of operating point(bias point) are V_GSQ =\",V_GSQ,\"V and I_DQ =\",I_DQ,\"mA\"\n",
+ "gm= KnWbyL*(V_GS-Vt) # in A/V\n",
+ "r_o= V_A/I_D #in \u03a9\n",
+ "# The gain is : Av= vo/vi = -gm*(R_D||R_L||r_o)\n",
+ "Av= -gm*(R_D*R_L*r_o/(R_D*R_L+R_D*r_o+R_L*r_o)) # in V/V\n",
+ "print \"VOltage gain is %0.1f V/V\" %Av\n",
+ "# i_i= (vi-vo)/R_G\n",
+ "# i_i= vi/R_G*(1-vo/vi) and Rin= vi/i_i = R_G/(1-Av)\n",
+ "Rin= R_G/(1-Av) # in \u03a9\n",
+ "print \"The input resistance = %0.2f M\u03a9\" %(Rin*10**-6)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The coordinates of operating point(bias point) are V_GSQ = 4.4 V and I_DQ = 1.06 mA\n",
+ "VOltage gain is -3.3 V/V\n",
+ "The input resistance = 2.34 M\u03a9\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 2.12 - page 143"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from numpy import sqrt\n",
+ "# Given data \n",
+ "I_D= 0.5 # in mA\n",
+ "I_D= I_D*10**-3 # in mA\n",
+ "V_D= 3 # in V\n",
+ "Vt= -1 # in V\n",
+ "KpWbyL= 1 # in mA/V**2\n",
+ "KpWbyL=KpWbyL*10**-3 # in A/V**2\n",
+ "# Formul I_D= 1/2*KpWbyL*(V_OV)**2\n",
+ "V_OV= sqrt(2*I_D/KpWbyL) # in V\n",
+ "# For PMOS\n",
+ "V_OV= -V_OV # in V\n",
+ "V_GS= V_OV+Vt # in V\n",
+ "R_D= V_D/I_D # in \u03a9\n",
+ "V_Dmax= V_D+abs(Vt) # in V\n",
+ "R_D= V_Dmax/I_D # in \u03a9 \n",
+ "print \"\"\"The largest value that R_D can have\n",
+ "while maintaining saturation-region operation is %0.2f k\u03a9\"\"\" %(R_D*10**-3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The largest value that R_D can have\n",
+ "while maintaining saturation-region operation is 8.00 k\u03a9\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 2.14 - page 145"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "# Given data \n",
+ "V_GS1= 1.5 # in V\n",
+ "Vt= 1 # in V\n",
+ "r_DS1= 1 # in k\u03a9\n",
+ "r_DS1= r_DS1*10**3 # in \u03a9\n",
+ "r_DS2= 200 # in k\u03a9\n",
+ "# r_DS1= 1/(KnWbyL*(V_GS1-Vt)) (i)\n",
+ "# r_DS2= 1/(KnWbyL*(V_GS2-Vt)) (i)\n",
+ "# dividing equation (i) by (ii)\n",
+ "V_GS2= (r_DS1/r_DS2)*(V_GS1-Vt)+Vt # in V\n",
+ "print \"To Optain rDS= 200, The value of V_GS should be %0.2f Volt\" %V_GS2\n",
+ "# For V_GS= 1.5 # V\n",
+ "# W2= 2*W1 \n",
+ "# r_DS1/r_DS2= 2\n",
+ "r_DS2= r_DS1/2 # in \u03a9\n",
+ "print \"For V_GS= 1.5 V , the value of r_DS2 = %0.1f \u03a9 \" %r_DS2\n",
+ "# For V_GS= 3.5 V\n",
+ "r_DS2= 200/2 # in \u03a9\n",
+ "print \"For V_GS= 3.5 V , the value of r_DS2 = %0.1f \u03a9\" %r_DS2"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "To Optain rDS= 200, The value of V_GS should be 3.50 Volt\n",
+ "For V_GS= 1.5 V , the value of r_DS2 = 500.0 \u03a9 \n",
+ "For V_GS= 3.5 V , the value of r_DS2 = 100.0 \u03a9\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 2.15 page 146"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from numpy import sqrt\n",
+ "# Given data \n",
+ "I_D= 0.2 # in mA\n",
+ "I_D= I_D*10**-3 # in mA\n",
+ "Vt= 1 # in V\n",
+ "KpWbyL= 0.1 # in mA/V**2\n",
+ "KpWbyL=KpWbyL*10**-3 # in A/V**2\n",
+ "# Formul I_D= 1/2*KpWbyL*(V_GS-VT)**2\n",
+ "V_GS= sqrt(2*I_D/KpWbyL)+Vt # in V\n",
+ "V_DSmin= V_GS-Vt # in V\n",
+ "print \"Required V_GS = %0.1f Volt\" %V_GS\n",
+ "print \"The minimum required V_DS = %0.1f Volt\" %V_DSmin\n",
+ "# For I_D= 0.8 mA\n",
+ "I_D = 0.8*10**-3 # in A\n",
+ "V_GS= sqrt(2*I_D/KpWbyL)+Vt # in V\n",
+ "V_DSmin= V_GS-Vt # in V\n",
+ "print \"Required V_GS = %0.1f Volt\" %V_GS\n",
+ "print \"The minimum required V_DS = %0.1f Volt\" %V_DSmin"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Required V_GS = 3.0 Volt\n",
+ "The minimum required V_DS = 2.0 Volt\n",
+ "Required V_GS = 5.0 Volt\n",
+ "The minimum required V_DS = 4.0 Volt\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 2.16 - page 147"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from numpy import sqrt\n",
+ "# Given data \n",
+ "V_SS= -5 # in V\n",
+ "unCox= 60 # in \u00b5A/V**2\n",
+ "unCox= unCox*10**-6 # in A/V**2\n",
+ "Vt= 1 # in V\n",
+ "W= 100 # in \u00b5m\n",
+ "L= 3 # in \u00b5m\n",
+ "V_G=0 # in V\n",
+ "V_DD= 5 # in V\n",
+ "V_D=0 #in V\n",
+ "I_D= 1*10**-3 # in A\n",
+ "# I_D= (V_DD-V_D)/R_D\n",
+ "R_D= (V_DD-V_D)/I_D # in \u03a9\n",
+ "print \"The value of R_D = %0.f k\u03a9\" %(R_D*10**-3)\n",
+ "# Formul I_D= 1/2*unCox*W/L*(V_GS-Vt)**2\n",
+ "V_GS= sqrt(2*I_D*L/(unCox*W))+Vt # in V\n",
+ "V_S= V_G-V_GS # in V\n",
+ "R_S= (V_S-V_SS)/I_D # in \u03a9\n",
+ "print \"The resistance = %0.f k\u03a9\" %(R_S*10**-3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of R_D = 5 k\u03a9\n",
+ "The resistance = 3 k\u03a9\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 2.17 - page 148"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from numpy import sqrt\n",
+ "# Given data \n",
+ "V_D= 3.5 # in V\n",
+ "I_D= 115*10**-6 #in A\n",
+ "upCox= 60 # in \u00b5A/V**2\n",
+ "upCox= upCox*10**-6 # in A/V**2\n",
+ "L= 0.8 #in \u00b5m\n",
+ "V_GS= -1.5 # in V\n",
+ "Vt= 0.7 # in V\n",
+ "R= V_D/I_D # in \u03a9\n",
+ "print \"The value required for R = %0.1f k\u03a9\" %(R*10**-3)\n",
+ "# Formul I_D= 1/2*upCox*W/L*(V_GS-Vt)**2\n",
+ "W= 2*I_D*L/(upCox*(V_GS-Vt)**2)\n",
+ "print \"The value required for W = %0.1f \u00b5m\" %(W)\n",
+ "\n",
+ "# Note: Calculation of evaluating the value of W in the book is wrong , so the Answer of the book is wrong "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value required for R = 30.4 k\u03a9\n",
+ "The value required for W = 0.6 \u00b5m\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 2.18 - page 149"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from numpy import sqrt\n",
+ "# Given data \n",
+ "Vt= 1 # in V\n",
+ "unCox= 120 # in \u00b5A/V**2\n",
+ "unCox= unCox*10**-6 # in A/V**2\n",
+ "L1=1 # in \u00b5m\n",
+ "L2=L1 # in \u00b5m\n",
+ "I_D= 120 #in \u00b5A\n",
+ "I_D= I_D*10**-6 #in A\n",
+ "V_GS1= 1.5 #in V\n",
+ "V_G2= 3.5 # in V\n",
+ "V_S2= 1.5 # in V\n",
+ "V_DD= 5 # in V\n",
+ "V_D2= 3.5 # in V\n",
+ "# Formul I_D= 1/2*unCox*W/L*(V_GS1-Vt)**2\n",
+ "W1= 2*I_D*L1/(unCox*(V_GS1-Vt)**2) # in \u00b5m\n",
+ "print \"The value of W1 = %0.1f \u00b5m\" %W1\n",
+ "V_GS2= V_G2-V_S2 #in V\n",
+ "# Formul I_D= 1/2*unCox*W/L*(V_GS1-Vt)**2\n",
+ "W2= 2*I_D*L2/(unCox*(V_GS2-Vt)**2) # in \u00b5m\n",
+ "print \"The value of W2 = %0.1f \u00b5m\" %W2\n",
+ "R= (V_DD-V_D2)/I_D # in \u03a9\n",
+ "print \"Resistance = %0.1f k\u03a9\" %(R*10**-3) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of W1 = 8.0 \u00b5m\n",
+ "The value of W2 = 2.0 \u00b5m\n",
+ "Resistance = 12.5 k\u03a9\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 2.19 - page 150"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from numpy import sqrt\n",
+ "# Given data \n",
+ "Vt= 2 # in V\n",
+ "K1WbyL= 1 # in mA/V**2\n",
+ "K1WbyL= K1WbyL*10**-3 #in mA/V**2\n",
+ "I_D= 10 #in \u00b5A\n",
+ "I_D= I_D*10**-6 #in A\n",
+ "V_DD= 10 # in V\n",
+ "R_D= 4 # in k\u03a9\n",
+ "R_D= R_D*10**3 # in \u03a9\n",
+ "\n",
+ "# Formul I_D= 1/2*K1WbyL*(V_GS-Vt)**2\n",
+ "V_GS= sqrt(2*I_D/K1WbyL)+Vt # in V\n",
+ "V1= -V_GS # in V\n",
+ "# Part (b)\n",
+ "I_D= 2 # in mA\n",
+ "I_D= I_D*10**-3 # in A\n",
+ "V2= V_DD-I_D*R_D #in V\n",
+ "# Formul I_D= 1/2*K1WbyL*(V_GS-Vt)**2\n",
+ "V_GS= sqrt(2*I_D/K1WbyL)+Vt # in V\n",
+ "V3= -V_GS # in V\n",
+ "# Part (c)\n",
+ "I_D= 1 # in mA\n",
+ "I_D= I_D*10**-3 # in A\n",
+ "# Formul I_D= 1/2*K1WbyL*(V_GS-Vt)**2\n",
+ "V_GS= sqrt(2*I_D/K1WbyL)+Vt # in V\n",
+ "V4= V_GS # in V\n",
+ "# Part (d)\n",
+ "I_D= 2 # in mA\n",
+ "R_D= 2.5 # in k\u03a9\n",
+ "R_D= R_D*10**3 # in \u03a9\n",
+ "V_SS= 10 # in V\n",
+ "I_D= I_D*10**-3 # in A\n",
+ "V_GS= sqrt(2*I_D/K1WbyL)+Vt # in V\n",
+ "V5= -V_SS+I_D*R_D # in V\n",
+ "print \"The value of V1 = %0.2f Volt\" %V1\n",
+ "print \"The value of V2 = %0.f Volt\" %V2\n",
+ "print \"The value of V3 = %0.f Volt\" %V3\n",
+ "print \"The value of V4 = %0.2f Volt\" %V4\n",
+ "print \"The value of V5 = %0.f Volt\" %V5"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of V1 = -2.14 Volt\n",
+ "The value of V2 = 2 Volt\n",
+ "The value of V3 = -4 Volt\n",
+ "The value of V4 = 3.41 Volt\n",
+ "The value of V5 = -5 Volt\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 2.20 - page 152"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "# Given data \n",
+ "unCox= 20*10**-6 #in A/V**2\n",
+ "upCox= unCox/2.5 # in A/V**2\n",
+ "V_DD= 3 #in V\n",
+ "Vt= 1 # in V\n",
+ "W= 30 # in \u00b5m\n",
+ "L= 10 # in \u00b5m\n",
+ "\n",
+ "# V_GS1= V_GS2\n",
+ "# Formula V_DD= V_GS1+V_GS2\n",
+ "V_GS1= V_DD/2 #in V\n",
+ "V_GS2= V_GS1 # in V\n",
+ "V2= V_GS1 # inV\n",
+ "I1= 1/2*unCox*W/L*(V_GS1-Vt)**2 # in A\n",
+ "# Both transistor have V_D = V_G and therefore they are operating in saturation \n",
+ "#1/2*unCox*W/L*(V4-Vt)**2 = 1/2*upCox*W/L*(V_DD-V4-Vt)\n",
+ "V4= (V_DD-Vt+sqrt(unCox/upCox))/(1+sqrt(unCox/upCox)) \n",
+ "I3= 1/2*unCox*W/L*(1.39-Vt)**2 \n",
+ "print \"The value of V2 = %0.1f Volt\" %V2\n",
+ "print \"The value of I1 = %0.1f \u00b5A\" %(I1*10**6,)\n",
+ "print \"The value of V4 = %0.1f Volt \" %V4\n",
+ "print \"The value of I3 = %0.1f \u00b5A\" %(I3*10**6)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of V2 = 1.5 Volt\n",
+ "The value of I1 = 7.5 \u00b5A\n",
+ "The value of V4 = 1.4 Volt \n",
+ "The value of I3 = 4.6 \u00b5A\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 2.22 - page 155"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from numpy import sqrt\n",
+ "# Given data \n",
+ "Vt= 0.9 # in V\n",
+ "V_A= 50 # in V\n",
+ "V_D= 2 # in V\n",
+ "R_L= 10 # in M\u03a9\n",
+ "R_L= R_L*10**3 # in \u03a9\n",
+ "R_G= 10 # in M\u03a9\n",
+ "R_G= R_G*10**6 # in \u03a9\n",
+ "I_D= 500 # in \u00b5A\n",
+ "I_D= I_D*10**-6 # in A\n",
+ "V_GS= V_D # in V\n",
+ "ro= V_A/I_D # in \u03a9\n",
+ "gm= 2*I_D/(V_GS-Vt) # in A/V\n",
+ "# vo= -gm*vi*(ro || R_L)\n",
+ "vo_by_vi = -gm*(ro*R_L/(ro+R_L)) # in V/V\n",
+ "print \"The voltage gain = %0.1f V/V\" %(vo_by_vi )\n",
+ "# For I= 1 mA or twice the current \n",
+ "I_D1= I_D # in A\n",
+ "I_D2= 2*I_D1 # in A\n",
+ "gm1= gm # in A/V\n",
+ "# Effect on V_D\n",
+ "# I_D1/I_D2 = (V_GS1-Vt)**2/(V_GS2-Vt)**2\n",
+ "V_GS1= V_GS \n",
+ "V_GS2= Vt+sqrt(2)*(V_GS1-Vt) # in V\n",
+ "print \"The new value of V_GS = %0.1f Volt\" %(V_GS2)\n",
+ "# Effect on gm\n",
+ "# gm1/gm2= sqrt(I_D1/I_D2)\n",
+ "gm2= sqrt(I_D2/I_D1)*gm1 # in A/V\n",
+ "print \"The new value of gm2 = %0.1f mA/V\" %(gm2*10**3)\n",
+ "# Effect on ro\n",
+ "# ro1/ro2= I_D2/I_D1\n",
+ "ro1= ro # in \u03a9\n",
+ "ro2= I_D1*ro1/I_D2 # in \u03a9\n",
+ "print \"The new value of ro = %0.1f k\u03a9/V\" %(ro2*10**-3)\n",
+ "# Effect on gain\n",
+ "# Av= -gm*(ro2 || R_L)\n",
+ "Av= -gm*(ro2*R_L/(ro2+R_L)) # in V/V\n",
+ "print \"The new value of voltage gain = %0.1f V/V\" %(Av)\n",
+ "#Answer wrong in the textbook because of calculation accuracy."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The voltage gain = -8.3 V/V\n",
+ "The new value of V_GS = 2.5 Volt\n",
+ "The new value of gm2 = 1.3 mA/V\n",
+ "The new value of ro = 50.0 k\u03a9/V\n",
+ "The new value of voltage gain = -7.6 V/V\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 2.23 - page 157"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from numpy import pi\n",
+ "# Given data \n",
+ "I_D= 1 # in mA\n",
+ "I_D= I_D*10**-3 # in A\n",
+ "gm= 1 #in mA/V\n",
+ "gm= gm*10**-3 #in A/V\n",
+ "f_L= 10 # in Hz\n",
+ "R_S= 6 # in k\u03a9\n",
+ "R_S= R_S*10**3 # in \u03a9\n",
+ "R_D= 10 # in k\u03a9\n",
+ "R_D= R_D*10**3 # in \u03a9\n",
+ "vo_by_vi= -gm*R_D/(1+gm*R_S) # in V/V\n",
+ "print \"Mid band gain = %0.2f V/V \" %(vo_by_vi)\n",
+ "# Formula f_L= 1/(2*pi*(1/gm || R_S)) * CS\n",
+ "CS= 1/(2*pi*(1/gm*R_S/(1/gm+R_S))*f_L) #in F\n",
+ "print \"The value of Cs = %0.2f \u00b5F\" %(CS*10**6)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Mid band gain = -1.43 V/V \n",
+ "The value of Cs = 18.57 \u00b5F\n"
+ ]
+ }
+ ],
+ "prompt_number": 29
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exa 2.24 - page 159"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from numpy import pi\n",
+ "# Given data \n",
+ "Rsig= 100 # in k\u03a9\n",
+ "Rsig= Rsig*10**3 # in \u03a9\n",
+ "R_G= 4.7 # in M\u03a9\n",
+ "R_G= R_G*10**6 # in \u03a9\n",
+ "R_D= 15 # in k\u03a9\n",
+ "R_D= R_D*10**3 # in \u03a9\n",
+ "R_L= R_D # in \u03a9\n",
+ "gm= 1 #in mA/V\n",
+ "gm= gm*10**-3 #in A/V\n",
+ "ro=150 # in k\u03a9\n",
+ "ro=ro*10**3 # in \u03a9\n",
+ "Cgs= 1 # in pF\n",
+ "Cgs=Cgs*10**-12 #in F\n",
+ "Cgd= 0.4 # in pF\n",
+ "Cgd=Cgd*10**-12 #in F\n",
+ "vgsBYvsig= R_G/(Rsig+R_G) \n",
+ "Rdesh_L= R_D*R_L/(R_D+R_L) # in \u03a9\n",
+ "voBYvgs= -gm*Rdesh_L \n",
+ "Av= voBYvgs/vgsBYvsig # in V/V\n",
+ "print \"The Mid-band gain = %0.2f V/V\" %(Av)\n",
+ "CM= Cgd*(1+gm*Rdesh_L) # in F\n",
+ "# f_H= 1/(2*pi*(Rsig || R_G)*(Cgs*CM))\n",
+ "f_H= 1/(2*pi*(Rsig * R_G/(Rsig + R_G))*(Cgs+CM)) # in Hz\n",
+ "print \"Frequency = %0.1f kHz\" %(f_H*10**-3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Mid-band gain = -7.66 V/V\n",
+ "Frequency = 369.4 kHz\n"
+ ]
+ }
+ ],
+ "prompt_number": 32
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}