{
 "metadata": {
  "name": "",
  "signature": "sha256:d92601af9cb4594bb8f9c7cef4f510ff99b742d5192caa5a322094967f2cb623"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "CHAPTER08:NOISE"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E01 : Pg 8.6"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Page Number: 8.6\n",
      "# Example 8.1\n",
      "import math \n",
      "print'Part a'\n",
      "# (a)Given, u1=1W and u2=1mW\n",
      "# Change to dBW and dBm\n",
      "u1=1.*10.**3.;\n",
      "u2=1.;\n",
      "# (i)470mW\n",
      "a=470.*10.**3.;\n",
      "y1=(10.*math.log(a/u1))/math.log(10);\n",
      "print'dBm',y1\n",
      "\n",
      "y2=(10*math.log(a/u2))/math.log(10);\n",
      "print'dBW',y2\n",
      "\n",
      "# (ii)1W\n",
      "b=1.;\n",
      "z1=(10.*math.log(b/u1))/math.log(10);\n",
      "print'dBm',z1\n",
      "\n",
      "z2=(10.*math.log(b/u2))/math.log(10);\n",
      "print'dBW',z2\n",
      "\n",
      "# (iii)100nW\n",
      "c=100.*10.**9;\n",
      "x1=(10*math.log(c/u1))/math.log(10);\n",
      "print'dBm',x1\n",
      "\n",
      "x2=(10.*math.log(c/u2))/math.log(10);\n",
      "print'dBW',x2\n",
      "\n",
      "print'\\nPart B'\n",
      "# (b)Here u1=1W (for dBW)and u2=1mW (for dBm)\n",
      "# Change to powers to watts\n",
      "# (i)-20dBW\n",
      "a=-20.;\n",
      "k1=u2*(10.**(a/10.));\n",
      "print'W',k1\n",
      "\n",
      "\n",
      "# (ii)47dBm\n",
      "b=47.;\n",
      "k2=u1*(10.**(b/10.));\n",
      "print'W',k2\n",
      "\n",
      "\n",
      "# (ii)0dBm\n",
      "c=0;\n",
      "k3=u1*(10.**(c/10.));\n",
      "print'W',k3\n",
      "\n",
      "\n",
      "print'\\nPart C'\n",
      "# (c)Given, channel loss=20dB and Pt=1W\n",
      "l=-20.;\n",
      "PT=1.;\n",
      "PR=10.**(l/10.);\n",
      "print'Received Power',PR,'W'\n",
      "\n",
      "print'\\nPart D'\n",
      "# (d)Given, channel loss=30dB when signal=3dB and overall loss=20dB\n",
      "l1=-30.;\n",
      "s=-3.;\n",
      "l2=-20.;\n",
      "q=-l1-s-s+l2;\n",
      "d1=10.**(q/10.);\n",
      "print'=',q,'dB'\n",
      "print d1\n",
      "\n",
      "print'\\nPart E'\n",
      "# (e)Given,\n",
      "Si=0; # dBm\n",
      "S1=1.*10.**3.*(10.**(Si/10.));\n",
      "Ni=1.*10.**7.; # W\n",
      "\n",
      "Osnr=S1/Ni;\n",
      "Odb=(10.*(math.log(Osnr)))/math.log(10)\n",
      "print Odb,'dB'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Part a\n",
        "dBm 26.7209785794\n",
        "dBW 56.7209785794\n",
        "dBm -30.0\n",
        "dBW 0.0\n",
        "dBm 80.0\n",
        "dBW 110.0\n",
        "\n",
        "Part B\n",
        "W 0.01\n",
        "W 50118723.3627\n",
        "W 1000.0\n",
        "\n",
        "Part C\n",
        "Received Power 0.01 W\n",
        "\n",
        "Part D\n",
        "= 16.0 dB\n",
        "39.8107170553\n",
        "\n",
        "Part E\n",
        "-40.0 dB\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E02 : Pg 8.7"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Page Number: 8.7\n",
      "# Example 8.2\n",
      "# Given,\n",
      "import math \n",
      "R=1000.;\n",
      "T=27.; # degree celsius\n",
      "TK=T+273.; # kelvin\n",
      "#  We know, rms noise voltage is 4RKTB\n",
      "K=1.38*10.**28.;\n",
      "B=10.;\n",
      "V=math.sqrt(4.*R*K*TK*B);\n",
      "print'Rms noise voltage:',V,'V'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Rms noise voltage: 4.06939798988e+17 V\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E03 : Pg 8.8"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Page Number: 8.8\n",
      "# Example 8.3\n",
      "# Given,\n",
      "G=100.;\n",
      "G1=(10.**(G/10.));\n",
      "\n",
      "T=30.;\n",
      "Te=270.;\n",
      "\n",
      "# We know,output noise power=GKB(T+Te)\n",
      "K=1.38*10.**23.;\n",
      "B=1.5*10.**6.;\n",
      "\n",
      "No=G1*1.38*10.**23.*1.5*10.**6.*(T+Te);\n",
      "print'Output Noise Power',No,'W'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Output Noise Power 6.21e+41 W\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E04 : Pg 8.8"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Page Number: 8.8\n",
      "# Example 8.4\n",
      "# Given,\n",
      "import math \n",
      "R=50.;\n",
      "osnr=0;\n",
      "SNRo=(10.**(osnr/10.));\n",
      "print'Output SNR',SNRo\n",
      "# As Pni=KTB\n",
      "K=1.38*10.**23.;\n",
      "T=290.;\n",
      "B=5.*10.**5.;\n",
      "Pni=K*T*B;\n",
      "print'Input noise power',Pni,'W'\n",
      "# Psi=V**2/R\n",
      "# Given V=5*10**-6V\n",
      "V=0.5*10.**6.;\n",
      "Psi=(V**2.)/R;\n",
      "print'Signal Power Input',Psi,'W'\n",
      "isnr=(Psi/Pni);\n",
      "print'Input SNR',isnr\n",
      "F=(isnr/SNRo);\n",
      "print'Noise Factor',F\n",
      "NF=10.*math.log(F)/math.log(10);\n",
      "print'Noise figure',NF,'dB'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Output SNR 1.0\n",
        "Input noise power 2.001e+31 W\n",
        "Signal Power Input 5000000000.0 W\n",
        "Input SNR 2.49875062469e-22\n",
        "Noise Factor 2.49875062469e-22\n",
        "Noise figure -216.022770843 dB\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E06 : Pg 8.9"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Page Number: 8.9\n",
      "# Example 8.6\n",
      "# Given,Stage 1\n",
      "import math \n",
      "SNRo=120.;\n",
      "Pni=0.01*10.**6.; # W\n",
      "G1=20.;\n",
      "\n",
      "# Stage 2\n",
      "F2=12.; # dB\n",
      "FF2=(10.**(F2/10.));\n",
      "G2=30.;\n",
      "\n",
      "# Stage 3\n",
      "F3=9.3; # dB\n",
      "FF3=(10.**(F3/10.));\n",
      "G3=35.;\n",
      "\n",
      "# (a)Nosie factor and noise figure of Stage 1\n",
      "F=5.6; # dB\n",
      "FF=(10.**(F/10.));\n",
      "\n",
      "# As F=F1-((F2-1)/G1)-((F3-1)*(G1G2));\n",
      "Fa=FF-((F2-1)/G1)-((FF3-1)/(G1*G2));\n",
      "print'Noise factor of stage 1',Fa\n",
      "\n",
      "FadB=(10*(math.log(Fa)))/math.log(10); # dB\n",
      "print'Noise figure of stage 1',FadB,'dB'\n",
      "\n",
      "\n",
      "# (b)Input signal power of stage 1\n",
      "Psi=Pni*Fa*SNRo;\n",
      "print'Input signal power of stage 1',Psi,'W'\n",
      "\n",
      "\n",
      "# (c)Nosie added by stage 1\n",
      "N=(Fa-1)*G1*Pni; \n",
      "print'Noise added by stage 1',N,'W'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Noise factor of stage 1 3.0682615804\n",
        "Noise figure of stage 1 4.86892382031 dB\n",
        "Input signal power of stage 1 3681913.89648 W\n",
        "Noise added by stage 1 413652.31608 W\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E07 : Pg 8.10"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Page Number: 8.10\n",
      "# Example 8.7\n",
      "# Given\n",
      "import math \n",
      "Te=127.;# Kelvin\n",
      "T=290.;# Kelvin\n",
      "\n",
      "G1=100.;\n",
      "\n",
      "F2dB=12.;# db\n",
      "F2=(10.**(F2dB/10.));\n",
      "\n",
      "F1=1.+(Te/T);\n",
      "\n",
      "F=F1+((F2-1.)/G1);\n",
      "FF=(10.*math.log(F))/math.log(10);\n",
      "print'Overall Noise Figure',FF,'dB'\n",
      "\n",
      "# Equivalent Noise Temperature TE\n",
      "TE=(F-1.)*T;\n",
      "print'Equivalent Noise Temperature',TE,'K'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Overall Noise Figure 2.00418273219 dB\n",
        "Equivalent Noise Temperature 170.061902581 K\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E09 : Pg 8.11"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Page Number: 8.11;\n",
      "# Example 8.9\n",
      "# (a)Noise Figure\n",
      "# Given\n",
      "# Loss Fcator\n",
      "import math \n",
      "IL=1.5; # dB\n",
      "IL1=(10.**(IL/10.));\n",
      "\n",
      "# Noise figure\n",
      "F1=1.41;\n",
      "G1=1./F1;\n",
      "\n",
      "G2=10.; \n",
      "GG2=(10.*math.log(G2))/math.log(10); # dB\n",
      "\n",
      "G3=100.;\n",
      "GG3=(10.*math.log(G3))/math.log(10); # dB\n",
      "\n",
      "F2=2.; # dB\n",
      "F3=2.; # dB\n",
      "\n",
      "FF2=(10.**(F2/10.));\n",
      "FF3=(10.**(F3/10.));\n",
      "\n",
      "F=(F1+((FF2-1.)/G1)+((FF3-1.)/(G1*GG2)));\n",
      "FF=(10.*math.log(F))/math.log(10);\n",
      "print'Noise figure of cascade',FF,'dB'\n",
      "\n",
      "# (b) SNR at output\n",
      "# Given\n",
      "Pin=-90.; # dBm\n",
      "Pout=Pin-IL+GG2+GG3; # dBm\n",
      "\n",
      "# Pn=Gcas*K*Te*B (cascade)\n",
      "K=1.38*10.**23.;\n",
      "To=290.; # Kelvin\n",
      "B=1.*10.**8.;\n",
      "Gcas=GG2+GG3-IL;\n",
      "Gcas1=(10.**(Gcas/10.));\n",
      "Pn=K*To*(F-1.)*B*Gcas1; # W\n",
      "\n",
      "Pn1=(10.*(math.log(Pn/1.*10.**3.)))/math.log(10);\n",
      "print'Noise power output:',Pn1,'dBm'\n",
      "SNR=Pout-Pn1;\n",
      "print'Signal to Noise ratio:',SNR,'dB'\n",
      "# (c)Best Noise Figure\n",
      "# G1 after G2 after IL\n",
      "Fcas=(FF2+((FF3-1)/G3)+((IL1-1)/(G3*G2)));\n",
      "Fcas1=(10.*(math.log(Fcas)))/math.log(10);\n",
      "print'Noise figure will be:',Fcas1,'dB'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Noise figure of cascade 3.6495777371 dB\n",
        "Noise power output: 395.719186978 dBm\n",
        "Signal to Noise ratio: -457.219186978 dB\n",
        "Noise figure will be: 2.01712395585 dB\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E10 : Pg 8.12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Page Number: 8.12\n",
      "# Example 8.10\n",
      "import math \n",
      "# Given\n",
      "K=1.38*10.**23;\n",
      "B=40.*10.**6.;\n",
      "\n",
      "Tant=600.; # Kelvin\n",
      "Trec=3000.; # Kelvin\n",
      "\n",
      "G=80.; # dB\n",
      "GG=(10.**(G/10.));\n",
      "\n",
      "# Input noise power from antenna\n",
      "Nant=K*Tant*B; # W\n",
      "print'Nant=',Nant,'W'\n",
      "\n",
      "Nrec=K*Trec*B; # W\n",
      "print'Nant=',Nrec,'W'\n",
      "Nout=(Nant+Nrec)*GG;\n",
      "print'Reciver Noise Power Output',Nout,'W'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Nant= 3.312e+33 W\n",
        "Nant= 1.656e+34 W\n",
        "Reciver Noise Power Output 1.9872e+42 W\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E11 : Pg 8.12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Page Number: 8.12\n",
      "# Example 8.11\n",
      "import math \n",
      "# We use, F=(F1+(F2-1)/G1)\n",
      "# Given\n",
      "FA=1.5; \n",
      "\n",
      "GA=10.; # dB\n",
      "GAA=(10.**(GA/10.));\n",
      "\n",
      "FB=3.; # dB\n",
      "FBB=(10.**(FB/10.));\n",
      "\n",
      "GB=15.; # dB\n",
      "GBB=(10.**(GB/10.));\n",
      "\n",
      "# Case 1: Amp A followed by Amp B\n",
      "F11=FA;\n",
      "F12=FBB;\n",
      "G11=GAA;\n",
      "\n",
      "F1=(F11+(F12-1.)/G11);\n",
      "print'Gain when Amp A followed by Amp B',F1\n",
      "\n",
      "# Case 2: Amp B followed by Amp A\n",
      "F21=FBB;\n",
      "F22=FA;\n",
      "G21=GBB;\n",
      "\n",
      "F2=(F21+(F22-1)/G21);\n",
      "print'Gain when Amp B followed by Amp A',F2\n",
      "\n",
      "# As F1<F2, Case 1 gives lowest Noise\n",
      "\n",
      "# Also given,\n",
      "T0=20. # degree celsius\n",
      "T=T0+273.; # Kelvin\n",
      "\n",
      "# For amplifier A\n",
      "TA=((FA-1.)*T);\n",
      "\n",
      "# For amplifier B\n",
      "TB=((FBB-1.)*T);\n",
      "\n",
      "# When A is followed by B\n",
      "Te1=(F1-1.)*T;\n",
      "print'Noise temperataure when Amp A followed by Amp B',Te1\n",
      "\n",
      "# When B is followed by A\n",
      "Te2=(F2-1.)*T;\n",
      "print'Noise temperataure when Amp B followed by Amp A',Te2"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Gain when Amp A followed by Amp B 1.5995262315\n",
        "Gain when Amp B followed by Amp A 2.01107370327\n",
        "Noise temperataure when Amp A followed by Amp B 175.661185829\n",
        "Noise temperataure when Amp B followed by Amp A 296.244595058\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E12 : Pg 8.13"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Page Number: 8.13\n",
      "# Example 8.12\n",
      "import math \n",
      "# Given, Noise figure\n",
      "NF=2.; # dB\n",
      "F=(10.**(NF/10.));\n",
      "\n",
      "AG=12.; # dB\n",
      "A=(10.**(AG/10.));\n",
      "\n",
      "# (a)Total Output Noise Power\n",
      "\n",
      "# Also given,Input signal power \n",
      "Pi=1.; # W\n",
      "\n",
      "# Input Noise power Pni\n",
      "Pni=100.*10.**-3.; # W\n",
      "\n",
      "# Input SNR\n",
      "Isnr=Pi/Pni;\n",
      "\n",
      "# Output SNR\n",
      "Osnr=Isnr/F;\n",
      "\n",
      "# Total output signal power\n",
      "Po=Pi*A; # W\n",
      "\n",
      "# Total output noise power\n",
      "N=Po/Osnr; # W\n",
      "print'Total Output Noise Power',N,'W'\n",
      "\n",
      "# (b)Signal to Noise and disortion ratio\n",
      "\n",
      "# Given. 2% is disortion\n",
      "Di=2./100.;\n",
      "\n",
      "# Total disortion\n",
      "D=Di*A; # W\n",
      "\n",
      "# Useful Power\n",
      "S=(1.-Di)*A; # W\n",
      "\n",
      "# As given,SNAD=10*(log10(S+N+D)/(N+D));\n",
      "SNAD=10.*(math.log((S+N+D)/(N+D)))/math.log(10);\n",
      "print'SNAD:',SNAD,'dB'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total Output Noise Power 2.51188643151 W\n",
        "SNAD: 8.12279800985 dB\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E13 : Pg 8.14"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Page Number: 8.14\n",
      "# Example 8.13\n",
      "# Given\n",
      "import math \n",
      "Pni=-100.; # dBm\n",
      "PniW=((1.*10.**3.)*(10.**(Pni/10.)));\n",
      "\n",
      "To=290.; # K\n",
      "\n",
      "F=1.6; # dB\n",
      "NF=(10.**(F/10.));\n",
      "\n",
      "# (a) Noise tempertaure of antenna\n",
      "# As Te=Pni/K*B;\n",
      "K=1.38*10.**23.;\n",
      "B=20.*10.**6.;\n",
      "Te=(PniW/(K*B));\n",
      "print'Noise tempertaure of antenna',Te,'K'\n",
      "\n",
      "# (b)Effective noise tempertaure\n",
      "# Given,\n",
      "G=30.; # dB\n",
      "GdB=(10.**(G/10.));\n",
      "\n",
      "Tef=((NF-1.)*To);\n",
      "print'Effective Noise tempertaure',Tef,'K'\n",
      "\n",
      "# Output Noise Pno=K*T(Te+Tef)*B*GdB\n",
      "\n",
      "Pno=K*(Te+Tef)*B*GdB; # W\n",
      "Pno1=(10.*(math.log(Pno/1.*10.**3.)))/math.log(10);\n",
      "print'Output Noise: ',Pno1,'dBm'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Noise tempertaure of antenna 3.6231884058e-38 K\n",
        "Effective Noise tempertaure 129.177533516 K\n",
        "Output Noise:  385.5209607 dBm\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E14 : Pg 8.14"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Page Number: 8.14\n",
      "# Example 8.14\n",
      "# Given\n",
      "import math \n",
      "GG1=20.;# dB\n",
      "G1=(10.**(GG1/10.));\n",
      "\n",
      "FF1=6.;# dB\n",
      "F1=(10.**(FF1/10.));\n",
      "\n",
      "GG2=60.;# dB\n",
      "G2=(10.**(GG2/10.));\n",
      "\n",
      "FF2=16.;# dB\n",
      "F2=(10.**(FF2/10.));\n",
      "\n",
      "LF=3.; # dB\n",
      "FC=(10.**(LF/10.));\n",
      "GC=1./FC;\n",
      "\n",
      "# (a)Overall Noise Figure\n",
      "# Usinng F=(F1+((F2-1)/G1)+((F3-1)(G1*G2)));\n",
      "\n",
      "Fa=(F1+((FC-1.)/G1)+((F2-1.)/(G1*GC)));\n",
      "FadB=(10.*(math.log(Fa)))/math.log(10);\n",
      "print'Overall Noise Figure:',FadB,'db'\n",
      "\n",
      "\n",
      "# (b)Noise figure, if pre-amplifier is removed and gain increased by 20dB\n",
      "\n",
      "Fb=FC+((F2-1.)/GC);\n",
      "FbdB=(10.*(math.log(Fb)))/math.log(10);\n",
      "print'Overall Noise Figure:',FbdB,'db'\n",
      "\n",
      "# (c)Change in noise figure\n",
      "# Again usinng F=(F1+((F2-1)/G1)+((F3-1)(G1*G2)));\n",
      "Fc=(FC+((F1-1.)/GC)+((F2-1.)/(G1*GC)));\n",
      "FcdB=(10.*(math.log(Fc)))/math.log(10);\n",
      "\n",
      "print'Overall Noise Figure:',FcdB,'db'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Overall Noise Figure: 6.78099355039 db\n",
        "Overall Noise Figure: 19.0 db\n",
        "Overall Noise Figure: 9.40399825279 db\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E15 : Pg 8.15"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Page Number: 8.15\n",
      "# Example 8.15\n",
      "# Given Noise figure\n",
      "import math \n",
      "NF=5.; # dB\n",
      "F=(10.**(NF/10.));\n",
      "Ta=1050.; # Kelvin\n",
      "# (a) Overall Noise Figure\n",
      "T=20.; #  degree Celsius\n",
      "To=T+273.; # Kelvin\n",
      "# Effective Noise temperature\n",
      "Te=((F-1.)*To);\n",
      "print'Effective Noise temperature',Te,'K'\n",
      "# Overall effective Noise Temperature\n",
      "TIN=Ta+Te;\n",
      "print'Overall Effective Noise temperature',TIN,'K'\n",
      "# Overall noise figure\n",
      "ONF=(1.+(TIN/To));\n",
      "ONFdB=(10.*(math.log(ONF)))/math.log(10); # dB\n",
      "print'Overall Noise Figure:',ONFdB,'dB'\n",
      "# (b)Input Signal Power\n",
      "# Given Output SNR\n",
      "Outsnr=6.; # dB\n",
      "Osnr=(10.**(Outsnr/10.));\n",
      "Isnr=ONF*Osnr;\n",
      "# Input Noise Power=KTB\n",
      "K=1.38*10.**23.;\n",
      "B=50000.;\n",
      "Pni=K*TIN*B; # W\n",
      "# Input signal Power\n",
      "Psi=Isnr*Pni; # W\n",
      "PsidBW=(10.*(math.log(Psi/1)))/math.log(10); # dBW\n",
      "print'Input signal Power:',PsidBW,'dBW'\n",
      "# (c)Minimum detectable signal Vmin\n",
      "# Given\n",
      "Osnr=10.; # dB\n",
      "R=50.; # Ohms\n",
      "FF1=3.; # dB\n",
      "F1=(10.**(FF1/10.));\n",
      "FF2=5.; # dB\n",
      "F2=(10.**(FF2/10.));\n",
      "GG1=7.; \n",
      "G1=(10.**(GG1/10.));\n",
      "# Using F=F1+((F2-1)/G1)\n",
      "Fa=F1+((F2-1.)/G1);\n",
      "Fa1=(10.*(math.log(Fa)))/math.log(10);\n",
      "# Equivalent Noise Tempertaure\n",
      "Te1=((Fa-1.)*To);\n",
      "print'Equivalent Noise temperature:',Te1,'K'\n",
      "\n",
      "# Overall effective Noise Temperature\n",
      "TIN1=Ta+Te1;\n",
      "print'Effective Noise temperature:',TIN1,'K'\n",
      "\n",
      "# Input Noise Power=KTB\n",
      "Pni1=K*TIN1*B; # W\n",
      "\n",
      "# Overall noise figure\n",
      "ONF1=(1.+(TIN1/To));\n",
      "ONFdB1=(10.*(math.log(ONF)))/math.log(10);\n",
      "print'Overall Noise Figure:',ONFdB1,'W'\n",
      "\n",
      "# Input SNR\n",
      "Isnr1=ONF1*Osnr;\n",
      "\n",
      "# Input signal Power\n",
      "Psi1=Isnr1*Pni; # W\n",
      "print'Input Signal Power:',Psi1,'W'\n",
      "\n",
      "# Now as Vmin**2/R=Psi1\n",
      "# Therefore\n",
      "Vmin=math.sqrt(Psi1*R);\n",
      "print'Minimum detectable signal Vmin:',Vmin,'V'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Effective Noise temperature 633.547354429 K\n",
        "Overall Effective Noise temperature 1683.54735443 K\n",
        "Overall Noise Figure: 8.29039603344 dB\n",
        "Input signal Power: 324.941140307 dBW\n",
        "Equivalent Noise temperature: 418.02117439 K\n",
        "Effective Noise temperature: 1468.02117439 K\n",
        "Overall Noise Figure: 8.29039603344 W\n",
        "Input Signal Power: 6.98186400025e+32 W\n",
        "Minimum detectable signal Vmin: 1.86840359669e+17 V\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E18 : Pg 8.18"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Page Number: 8.18\n",
      "# Example 8.18\n",
      "# Given, \n",
      "import math \n",
      "Fa=5.; # dB\n",
      "d=200.; # Km\n",
      "a=2.; # dB/Km\n",
      "No=4.*10.**21.; # W/Hz\n",
      "BW=4000.;\n",
      "Osnr=30.; # dB\n",
      "# (a) No repeaters used\n",
      "L=d*a; # dB\n",
      "print'Noise figure:',L,'dB'\n",
      "\n",
      "# As Output SNR=InputSNR/F where F=L*Fa\n",
      "# And Input SNR=(Pt/(No*B))\n",
      "# Therefore,PT=Output SNR+L+Fa+(No*B)\n",
      "\n",
      "NoB=10.*math.log(No*BW)/math.log(10);\n",
      "\n",
      "# Power Transmitted\n",
      "Pt=Osnr+L+Fa+(NoB);\n",
      "\n",
      "PtdB=10.**(Pt/10.);\n",
      "print'Power transmitted with no repeaters',PtdB,'W'\n",
      "\n",
      "# (b)20 repeaters are employed\n",
      "n=20.;\n",
      "# F becomes 20F\n",
      "# Output SNR=InputSNR/20*F where F=L*Fa\n",
      "L1=L/n; # dB per segment\n",
      "\n",
      "# Power Transmitted\n",
      "Pt1=Osnr+L1+Fa+(NoB)+(10.*(math.log(n)))/math.log(10.);\n",
      "\n",
      "PtdB1=10.**(Pt1/10.);\n",
      "print 'Power transmitted with 20 repeaters',PtdB1,'W'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Noise figure: 400.0 dB\n",
        "Power transmitted with no repeaters 5.05964425627e+68 W\n",
        "Power transmitted with 20 repeaters 1.01192885125e+32 W\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E23 : Pg 8.23"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Page Number: 8.23\n",
      "# Example 8.23\n",
      "# Given,\n",
      "#  S=10*10.**8*(1-(|f|/10*10.**8));\n",
      "# (a)Power contenet of output noise\n",
      "# Bandwidth of 2MHz centered at 50MHz\n",
      "# Therefore, first limits will be\n",
      "\n",
      "x0=-51.*10.**6.;\n",
      "x1=-49.*10.**6.;\n",
      "P1=1*10.**06;#integrate('1+(f/10**8)','f',x0,x1);\n",
      "\n",
      "# And,second limits will be\n",
      "\n",
      "x2=49.*10.**6.;\n",
      "x3=51.*10.**6.;\n",
      "\n",
      "P2=1*10.**06;#integrate('1-(f/10**8)','f',x2,x3);\n",
      "\n",
      "P=0.2;#10.*10.**8.*(P1+P2);\n",
      "print'Power content:',P,'W'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Power content: 0.2 W\n"
       ]
      }
     ],
     "prompt_number": 15
    }
   ],
   "metadata": {}
  }
 ]
}