{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 4 - High Frequency Amplifiers"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.1 Page No. 4-34"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(i) g_m = I_C / V_T =38.46 mA/V\n",
      "(ii) r_b''e = h_fe / g_m =5.20 kohm\n",
      "(iii) (C_e + C_C) = g_m / 2*pi*f_T = g_m / omega_T =-76.92 pF\n",
      "Therefore,  C_b''e  = C_e =73.92 pF\n",
      "(iv) We know that,\n",
      "f_T = h_fe*f_beta\n",
      "Therefore,  2*pi*f_T = h_fe*2*pi*f_beta\n",
      "omega_T = h_fe*omega_beta\n",
      "omega_beta = omega_T / h_fe =2500.00 rad/s\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division  \n",
    "gm=(1/26)*10**3\n",
    "print \"(i) g_m = I_C / V_T =%0.2f mA/V\"%gm\n",
    "rbe=200/(38.46)\n",
    "print \"(ii) r_b''e = h_fe / g_m =%0.2f kohm\"%rbe\n",
    "cc=((38.46*10**-3)/(500*10**6))*10**12\n",
    "print \"(iii) (C_e + C_C) = g_m / 2*pi*f_T = g_m / omega_T =%0.2f pF\"%-cc\n",
    "cbe=76.92-3\n",
    "print \"Therefore,  C_b''e  = C_e =%0.2f pF\"%cbe\n",
    "print \"(iv) We know that,\"\n",
    "print \"f_T = h_fe*f_beta\"\n",
    "print \"Therefore,  2*pi*f_T = h_fe*2*pi*f_beta\"\n",
    "print \"omega_T = h_fe*omega_beta\"\n",
    "ob=((500*10**6)/200)*10**-3\n",
    "print \"omega_beta = omega_T / h_fe =%0.2f rad/s\"%ob"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.2 Page No. 4-35"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(i) f_T = |A_i|*f =50.00 MHz\n",
      "(ii) h_fe(in kHz) = f_T / f_beta =250.00 kHz\n",
      "(iii) |A_i| = h_fe / sqrt(1+((f/f_beta)**2)) :\n",
      "At  f = 10 MHz\n",
      "|A_i| =5.00\n",
      "At  f = 100 MHz\n",
      "|A_i| =0.50\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "from __future__ import division  \n",
    "ft=25*2\n",
    "print \"(i) f_T = |A_i|*f =%0.2f MHz\"%ft\n",
    "hfe=50000/200\n",
    "print \"(ii) h_fe(in kHz) = f_T / f_beta =%0.2f kHz\"%hfe\n",
    "print \"(iii) |A_i| = h_fe / sqrt(1+((f/f_beta)**2)) :\"\n",
    "print \"At  f = 10 MHz\"\n",
    "ai=250/sqrt(1+(((10*10**6)/(200*10**3))**2))\n",
    "print \"|A_i| =%0.2f\"%ai\n",
    "print \"At  f = 100 MHz\"\n",
    "ai=250/sqrt(1+(((100*10**6)/(200*10**3))**2))\n",
    "print \"|A_i| =%0.2f\"%ai"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.10 Page No. 4-39"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a) The 3dB frequency for circuit gain and voltage gain is given as,\n",
      "(f_H)=1/(2*pi*R_eq*C_eq)\n",
      "where R_eq =(R_s+r_bb'')parallel to r+b''e =166.67 ohm\n",
      "and  C_eq =(C_b''e)+(1+(g_m*R_L)*C_b''c)= 0.00 F\n",
      "f_H = 3774350.04 Hz\n",
      "b)Voltage gain is given as,\n",
      "A=(-g_m*R_L)=-50.00\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt,pi\n",
    "from __future__ import division  \n",
    "print \"a) The 3dB frequency for circuit gain and voltage gain is given as,\"\n",
    "print \"(f_H)=1/(2*pi*R_eq*C_eq)\"\n",
    "r=(200*1000)/(200+1000)\n",
    "print \"where R_eq =(R_s+r_bb'')parallel to r+b''e =%0.2f ohm\"%r\n",
    "c=(100*10**-12)+((1+50)*3*10**-12)\n",
    "print \"and  C_eq =(C_b''e)+(1+(g_m*R_L)*C_b''c)= %0.2f F\"%c\n",
    "f=1/((2*pi*166.67*253*10**-12))\n",
    "print \"f_H = %0.2f Hz\"%f\n",
    "print \"b)Voltage gain is given as,\"\n",
    "a=(-50*1)\n",
    "print \"A=(-g_m*R_L)=%0.2f\"%a"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.12 Page No. 4-40"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "f_H=1/(2*pi*R_eq*C_eq)\n",
      "and f_H''=2(f_H)\n",
      "1/(2*pi*R_eq*C_eq) = 2/(2*pi*R_eq*C_eq)\n",
      "R_eq'' = R_eq/2\n",
      "R_eq=(r_b''e)parallel to (r_bb''+R_s)\n",
      "= (r_b''e)=1000 ohm\n",
      "Therefore  R_eq'' =500 ohm\n",
      "Therefore  500=((r_b''e)*(r_bb''+R_s))/((r_b''e)+(r_bb'')+R_s)\n",
      " = 1000(100+R_s)/(1000+100+R_s)\n",
      "R_s = 900.00 ohm\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division  \n",
    "print \"f_H=1/(2*pi*R_eq*C_eq)\"\n",
    "print \"and f_H''=2(f_H)\"\n",
    "print \"1/(2*pi*R_eq*C_eq) = 2/(2*pi*R_eq*C_eq)\"\n",
    "print \"R_eq'' = R_eq/2\"\n",
    "print \"R_eq=(r_b''e)parallel to (r_bb''+R_s)\"\n",
    "print \"= (r_b''e)=1000 ohm\"\n",
    "print \"Therefore  R_eq'' =500 ohm\"\n",
    "print \"Therefore  500=((r_b''e)*(r_bb''+R_s))/((r_b''e)+(r_bb'')+R_s)\"\n",
    "print \" = 1000(100+R_s)/(1000+100+R_s)\"\n",
    "r=(4.5*10**5)/500\n",
    "print \"R_s = %0.2f ohm\"%r"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.16 Page No. 4-44"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Hybrid-pi Equivalent is as shown in fig.4.29\n",
      "(i) Mid frequency voltage gain :\n",
      "V_o / V_s = -h_fe*R_L / R_s+h_ie\n",
      "h_ie = r_bb'' + r_b''e =1.10 kohm\n",
      "h_fe = g_m * r_b''e =200.00\n",
      "Therefore,  V_o / V_s =-100.00\n",
      "(ii) f_beta = 1 / 2*pi*r_b''e*(C_e+C_C) =780.17 kHz\n",
      "f_beta = 780.17 kHz\n",
      "(iii) f_T = h_fe * f_beta =156.00 kHz\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt,pi\n",
    "from __future__ import division  \n",
    "print \"Hybrid-pi Equivalent is as shown in fig.4.29\"\n",
    "print \"(i) Mid frequency voltage gain :\"\n",
    "print \"V_o / V_s = -h_fe*R_L / R_s+h_ie\"\n",
    "hie=(100+1000)*10**-3\n",
    "print \"h_ie = r_bb'' + r_b''e =%0.2f kohm\"%hie\n",
    "hfe=0.2*1000\n",
    "print \"h_fe = g_m * r_b''e =%0.2f\"%hfe\n",
    "vo=-200/2\n",
    "print \"Therefore,  V_o / V_s =%0.2f\"%vo\n",
    "fb=(1/(2*pi*1000*(204*10**-12)))*10**-3\n",
    "print \"(ii) f_beta = 1 / 2*pi*r_b''e*(C_e+C_C) =%0.2f kHz\"%fb\n",
    "print \"f_beta = %0.2f kHz\"%fb\n",
    "ft=(200*780)*10**-3\n",
    "print \"(iii) f_T = h_fe * f_beta =%0.2f kHz\"%ft"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.17 Page No. 4-44"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(i) We know that,\n",
      "  f_H = 1 / 2*pi*R_eq*C_eq\n",
      "where  R_eq = (R_s+r_bb'')*r_b''e / R_s+r_bb''+r_b''e\n",
      "and  C_eq = C_e + C_C*[1+g_m*R_L]\n",
      "  r_b''e(in k-ohm) = h_fo / g_m = 1.00 kohm\n",
      "C_eq = C_e + C_C*[1+g_m*R_L] = C_e + C_C[1+100*10**-3*500]\n",
      "     = C_e + 51 pF\n",
      "C_e = g_m / 2*pi*f_T =39.79 pF\n",
      "Therefore,  C_eq =90.79 pF\n",
      "R_eq = 1 / 2*pi*f_H*C_eq =350.60 ohm\n",
      "Therefore, 350.6 = (R_s+100)*1000 / R_s+1100\n",
      "Therefore,  R_s = 439.88 ohm\n",
      "(ii) The mid-band voltage gain V_o/V_s is given as\n",
      "  V_o/V_s = -h_fe*R_L / R_s+h_ie\n",
      "where  h_ie = r_bb'' + r_b''e =1.10 K\n",
      "Therefore,  V_o/V_s =-32.47\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt,pi\n",
    "from __future__ import division  \n",
    "print \"(i) We know that,\"\n",
    "print \"  f_H = 1 / 2*pi*R_eq*C_eq\"\n",
    "print \"where  R_eq = (R_s+r_bb'')*r_b''e / R_s+r_bb''+r_b''e\"\n",
    "print \"and  C_eq = C_e + C_C*[1+g_m*R_L]\"\n",
    "rbe=100/100\n",
    "print \"  r_b''e(in k-ohm) = h_fo / g_m = %0.2f kohm\"%rbe\n",
    "print \"C_eq = C_e + C_C*[1+g_m*R_L] = C_e + C_C[1+100*10**-3*500]\"\n",
    "print \"     = C_e + 51 pF\"\n",
    "ce=((100*10**-3)/(2*pi*(400*10**6)))*10**12\n",
    "print \"C_e = g_m / 2*pi*f_T =%0.2f pF\"%ce\n",
    "ceq=39.79+51\n",
    "print \"Therefore,  C_eq =%0.2f pF\"%ceq\n",
    "req=1/(2*pi*5*90.79*10**-6)\n",
    "print \"R_eq = 1 / 2*pi*f_H*C_eq =%0.2f ohm\"%req\n",
    "print \"Therefore, 350.6 = (R_s+100)*1000 / R_s+1100\"\n",
    "rs=(285.66*10**3)/649.4\n",
    "print \"Therefore,  R_s = %0.2f ohm\"%rs\n",
    "print \"(ii) The mid-band voltage gain V_o/V_s is given as\"\n",
    "print \"  V_o/V_s = -h_fe*R_L / R_s+h_ie\"\n",
    "hie=(100+1000)*10**-3\n",
    "print \"where  h_ie = r_bb'' + r_b''e =%0.2f K\"%hie\n",
    "vo=(-100*500)/(439.88+1100)\n",
    "print \"Therefore,  V_o/V_s =%0.2f\"%vo"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4.20 Page No. 4-47"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Assume that the output time-constant is negligible as compared to the time consedtant. When this is the case\n",
      "A_vs = V_o/V_s = -g_m*R''_L*G''_s / G''_s+g_b''e+sC\n",
      "where  G''_s = 1 / (R_s||R_b)+r_bb'' =0.01\n",
      "g_b''e = 1 / r_b''e =0.00\n",
      "R''_L = R_L || R_C =333.33 ohm\n",
      "  sC = admittance of C\n",
      "where  C = C_e + C_C*(1+g_m*R''_L) =153.00\n",
      "At 10 kHz,\n",
      "sC = 2*pi*f*C =0.00\n",
      "Therefore, At 10kHz signal frequency\n",
      "A_vs = V_o / V_s =-14.47\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt,pi\n",
    "from __future__ import division  \n",
    "print \"Assume that the output time-constant is negligible as compared to the time consedtant. When this is the case\"\n",
    "print \"A_vs = V_o/V_s = -g_m*R''_L*G''_s / G''_s+g_b''e+sC\"\n",
    "gs=6.66*10**-3\n",
    "print \"where  G''_s = 1 / (R_s||R_b)+r_bb'' =%0.2f\"%gs\n",
    "gbe=1/1000\n",
    "print \"g_b''e = 1 / r_b''e =%0.2f\"%gbe\n",
    "rl=(0.5/1.5)*10**3\n",
    "print \"R''_L = R_L || R_C =%0.2f ohm\"%rl\n",
    "print \"  sC = admittance of C\"\n",
    "c=100+(3*(1+(50*333.33*10**-3)))\n",
    "print \"where  C = C_e + C_C*(1+g_m*R''_L) =%0.2f\"%c\n",
    "print \"At 10 kHz,\"\n",
    "sc=2*pi*10*153*10**-9\n",
    "print \"sC = 2*pi*f*C =%0.2f\"%sc\n",
    "print \"Therefore, At 10kHz signal frequency\"\n",
    "avs=(-50*333.33*6.66*10**-6)/((6.66*10**-3)+(10**-3)+(9.613*10**-6))\n",
    "print \"A_vs = V_o / V_s =%0.2f\"%avs"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
