summaryrefslogtreecommitdiff
path: root/sample_notebooks/Nitin Kumar
diff options
context:
space:
mode:
authorThomas Stephen Lee2015-08-28 16:53:23 +0530
committerThomas Stephen Lee2015-08-28 16:53:23 +0530
commitdb0855dbeb41ecb8a51dde8587d43e5d7e83620f (patch)
treeb95975d958cba9af36cb1680e3f77205354f6512 /sample_notebooks/Nitin Kumar
parent5a86a20b9de487553d4ef88719fb0fd76a5dd6a7 (diff)
downloadPython-Textbook-Companions-db0855dbeb41ecb8a51dde8587d43e5d7e83620f.tar.gz
Python-Textbook-Companions-db0855dbeb41ecb8a51dde8587d43e5d7e83620f.tar.bz2
Python-Textbook-Companions-db0855dbeb41ecb8a51dde8587d43e5d7e83620f.zip
add books
Diffstat (limited to 'sample_notebooks/Nitin Kumar')
-rwxr-xr-xsample_notebooks/Nitin Kumar/chapter12.ipynb471
1 files changed, 471 insertions, 0 deletions
diff --git a/sample_notebooks/Nitin Kumar/chapter12.ipynb b/sample_notebooks/Nitin Kumar/chapter12.ipynb
new file mode 100755
index 00000000..ceed3190
--- /dev/null
+++ b/sample_notebooks/Nitin Kumar/chapter12.ipynb
@@ -0,0 +1,471 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:1379f2f8d6e289c373beb86705dd50349840a6850fd79932957ae177aa587cc0"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 12 : Microwave Measurements"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 12.1 Page Number: 649"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Given\n",
+ "Is=0.1*(10**-6) #A\n",
+ "Pi=0 #dBm\n",
+ "Cs=0.1*(10**-12) #F\n",
+ "Ls=2*(10**-9) \n",
+ "Cj=0.15*(10**-12) #F\n",
+ "Rs=10 #ohm\n",
+ "T=293 #K\n",
+ "nktbye=25*(10**-3) #V\n",
+ "\n",
+ "#Rj\n",
+ "Rj=(nktbye/Is) \n",
+ "print 'Rj =',Rj/1000,'kohm'\n",
+ "\n",
+ "#Bi\n",
+ "Bi=nktbye/2 \n",
+ "Bii=Bi*1000 \n",
+ "print 'Bi =',Bii,'A/W' \n",
+ "\n",
+ "#Bv\n",
+ "Bv=Rj*Bii \n",
+ "print 'Bv =',Bv,'V/W' "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Rj = 250.0 kohm\n",
+ "Bi = 12.5 A/W\n",
+ "Bv = 3125000.0 V/W\n"
+ ]
+ }
+ ],
+ "prompt_number": 35
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 12.2 Page Number: 650"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import log10\n",
+ "#Given\n",
+ "vswr=4.0 \n",
+ "\n",
+ "modT=(vswr-1)/(vswr+1) \n",
+ "Lm=-10*log10(1-(modT*modT)) #dB\n",
+ "print 'Mismatch Loss =',round(Lm,3),'dB' \n",
+ "\n",
+ "#Sensitivity reduces by a factor\n",
+ "Bvd=(1-(modT*modT)) \n",
+ "Bvdp=Bvd*100 \n",
+ "print 'Voltge sensitivity reduces by',Bvdp,\"%\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Mismatch Loss = 1.938 dB\n",
+ "Voltge sensitivity reduces by 64.0 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 36
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 12.3 Page Number: 650"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import sqrt, pi\n",
+ "#Given\n",
+ "f=10E+9 #Hz\n",
+ "c=3E+10 #cm/s\n",
+ "a=4 #cm\n",
+ "s=0.1 #cm\n",
+ "lmb=c/f #cm\n",
+ "lmbg=lmb/(sqrt(1-((lmb/(2*a))**2))) \n",
+ "vswr=lmbg/(pi*s) \n",
+ "print 'VSWR =',round(vswr,3) \n",
+ "\n",
+ "#Answer in book for lmbg is given as 3.49 but it should be 3.23 and hence the answer will be 10.3"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "VSWR = 10.301\n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 12.4 Page Number: 651"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Given\n",
+ "delx=3.5 #cm\n",
+ "s=0.25 #cm\n",
+ "\n",
+ "lmbg=2*delx \n",
+ "vswr=lmbg/(pi*s) \n",
+ "print 'VSWR =',round(vswr,3) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "VSWR = 8.913\n"
+ ]
+ }
+ ],
+ "prompt_number": 38
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 12.5 Page Number: 651"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Given\n",
+ "vswr=2.0 \n",
+ "Pin=4.5E-3 #W\n",
+ "\n",
+ "modT=(vswr-1)/(vswr+1) \n",
+ "#Power reflected,\n",
+ "Pr=(modT**2)*Pin \n",
+ "#As coupler samples only 1/1000th power\n",
+ "Prr=Pr*1000 \n",
+ "print 'Reflected Power =',Prr,'W' "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Reflected Power = 0.5 W\n"
+ ]
+ }
+ ],
+ "prompt_number": 39
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 12.6 Page Number: 652"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Given\n",
+ "from math import tan, sqrt, pi\n",
+ "Z0=50 #ohm\n",
+ "p=2.4 \n",
+ "L=0.313 \n",
+ "x=2*pi*L \n",
+ "y=tan(x) \n",
+ "\n",
+ "Zl=(Z0*(1+(p*p*1J)))/(p+(p*1J)) \n",
+ "T=(Zl-Z0)/(Zl+Z0) \n",
+ "p=sqrt(T.real**2+T.imag**2) \n",
+ "print 'Reflection coefficient =',round(p,2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Reflection coefficient = 0.41\n"
+ ]
+ }
+ ],
+ "prompt_number": 40
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 12.7 Page Number: 652"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Given\n",
+ "Zl=25+25*1J #ohm\n",
+ "Z0=50 #ohm\n",
+ "\n",
+ "T=(Zl-Z0)/(Zl+Z0) \n",
+ "p=sqrt(T.real**2+T.imag**2) \n",
+ "print 'Reflection coefficient =',round(p,2) \n",
+ "\n",
+ "vswrr=(1+p)/(1-p) \n",
+ "print 'VSWR =', round(vswrr,2) \n",
+ "\n",
+ "#Fraction of power delivered\n",
+ "Pd=1-(p**2) \n",
+ "Pdp=Pd*100 \n",
+ "print 'Fraction of power delivered =',Pdp,'%' "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Reflection coefficient = 0.45\n",
+ "VSWR = 2.62\n",
+ "Fraction of power delivered = 80.0 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 41
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 12.8 Page Number: 653"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Given\n",
+ "d=2.4 #cm\n",
+ "lmbc=1.8 \n",
+ "c=3*10**10 #cm/s\n",
+ "\n",
+ "lmbg=2*d \n",
+ "lmb=(lmbg*lmbc)/(sqrt(lmbg**2+lmbc**2)) \n",
+ "#Operating frequency\n",
+ "f=c/lmb \n",
+ "print 'Operating frequency =',round((f/10**9),2), 'GHz' "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Operating frequency = 17.8 GHz\n"
+ ]
+ }
+ ],
+ "prompt_number": 42
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 12.9 Page Number: 653"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "from numpy import array#Given\n",
+ "p=1.5 \n",
+ "IsL=1 #dB\n",
+ "InL=30 #dB\n",
+ "\n",
+ "S21=10**(-IsL/20) \n",
+ "\n",
+ "#Assuming three ports to be identical\n",
+ "S32=S21 \n",
+ "S13=S21 \n",
+ "\n",
+ "#Isolations are also the same\n",
+ "S31=10**(-InL/20) \n",
+ "S23=S31 \n",
+ "S12=S31 \n",
+ "\n",
+ "#Refelction coefficients are also the same\n",
+ "T=(p-1)/(p+1) \n",
+ "S11=T \n",
+ "S22=T \n",
+ "S33=T \n",
+ "\n",
+ "S=array([S11,S12,S13,S21,S22,S23,S31,S32,S33] )\n",
+ "print 'Matrix is:',S "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Matrix is: [ 0.2 0.01 0.1 0.1 0.2 0.01 0.01 0.1 0.2 ]\n"
+ ]
+ }
+ ],
+ "prompt_number": 43
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 12.10 Page Number: 654"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Given\n",
+ "R1=10.6 #GHz\n",
+ "R2=8.30 #GHz\n",
+ "Q0=8200 \n",
+ "Q0d=890.0 \n",
+ "\n",
+ "Er=(R1/R2)**2 \n",
+ "print 'Dielectric constant =', round(Er ,2)\n",
+ "\n",
+ "Qd=(Q0-Q0d)/(Q0*Q0d) \n",
+ "print 'Loss tangent of dielectric =',round(Qd ,4)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Dielectric constant = 1.63\n",
+ "Loss tangent of dielectric = 0.001\n"
+ ]
+ }
+ ],
+ "prompt_number": 44
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 12.11 Page Number: 654"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Given\n",
+ "l0=0.15 #cm\n",
+ "lmbg=2*2.24 #cm\n",
+ "le=1.14 #cm\n",
+ "a=2.286 #cm\n",
+ "d=2 \n",
+ "\n",
+ "B0=(2*pi)/lmbg \n",
+ "x=tan(B0*l0)/(B0*l0) \n",
+ "#Also\n",
+ "x1=(l0*x)/le \n",
+ "#Correct value seems to be\n",
+ "Bele=2.786 \n",
+ "e1=((((a/pi)**2)*(Bele/le)**2)+1) \n",
+ "e2=(((2*a)/lmbg)**2)+1 \n",
+ "Er=e1/e2 \n",
+ "print 'Er =',round(Er ,3)\n",
+ "\n",
+ "\n",
+ "#Answer in book for Er is given as 2.062 but it should be 2.038"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Er = 2.039\n"
+ ]
+ }
+ ],
+ "prompt_number": 45
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file