{ "metadata": { "name": "", "signature": "sha256:4e82c096f59276d07f565f054e36b76b972f48192010c629f646cb460b6d633f" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "chapter06:Microwave components" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 6.2, Page number 234" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Chapter-6, Example 6.2, Page 234\n", "#=============================================================================\n", "#Input parameters\n", "#[s]=[0,(0.3+(%i)*(0.4));(0.3+(%i)*(0.4)),0];#scattering matrix of a two port\n", "#Calculations\n", "#to find l such that S12 and S21 will be real when port1 is shifted lm to the left\n", "#let port 1 be shifted by phi1 degree to the left and port2 position be remained unchanged i.e.,phi2=delta\n", "#Then [phi]=[e**-(j*phi1),0;0,1]\n", "#[S']=[phi]*[s]*[phi]\n", "#for S12 and S21 to be real\n", "import math\n", "phi1=53.13;#in degrees\n", "phi1=phi1*(math.pi/180);#phi in radians\n", "b=34.3;#measured in rad/m\n", "l=(phi1)/b;#distance of shift in m\n", "#Output\n", "print \"distance that the position of part1 should be shifted to the left so that S21 and S12 will be real numbers is (m) = \",round(l,3)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "distance that the position of part1 should be shifted to the left so that S21 and S12 will be real numbers is (m) = 0.027\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 6.3, Page number 236" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Chapter-6, Example 6.3, Page 236\n", "#=============================================================================\n", "import math\n", "import numpy\n", "from math import sqrt\n", "#Input parameters\n", "D=30.;#directivity in dB\n", "VSWR=1.;#VSWR at each port under matched conditions\n", "C=10.;#coupling factor\n", "#Calculations\n", "S41=sqrt(0.1);\n", "S14=S41;#under matched and lossless conditions\n", "S31=sqrt(((S41)**2)/(10)**(D/10));\n", "S13=S31;\n", "S11=(VSWR-1)/(VSWR+1);\n", "S22=S11;\n", "S33=S22;\n", "S44=S33;\n", "#let input power is given at port1 \n", "#p1=p2+P3+p4\n", "S21=sqrt(1-(S41)**2-(S31)**2);\n", "S12=S21;\n", "S34=sqrt((0.5)*(1+(S12)**2-0.1-0.0001));\n", "S43=S34\n", "S23=sqrt(1-10**-4-(S34)**2)\n", "S32=S23;\n", "S24=sqrt(1-0.1-(S34)**2)\n", "S42=S24;\n", "S=numpy.matrix([[S11,S12,S13,S14],[S21,S22,S23,S24],[S31,S32,S33,S34],[S41,S42,S43,S44]]);\n", "#Output\n", "print \"The scattering matrix is\"\n", "print S\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The scattering matrix is\n", "[[ 0. 0.94863059 0.01 0.31622777]\n", " [ 0.94863059 0. 0.31622777 0.01 ]\n", " [ 0.01 0.31622777 0. 0.94863059]\n", " [ 0.31622777 0.01 0.94863059 0. ]]\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 6.4, Page number 238" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Chapter-6, Example 6.4, Page 238\n", "#=============================================================================\n", "import numpy\n", "#Input parameters\n", "a1=32*10**-3;#power in watts\n", "a2=0;\n", "a3=0;\n", "#Calculations\n", "S=numpy.array([[0.5,-0.5,0.707],[-0.5,0.5,0.707],[0.707,0.707,0]]);#S-matrix for H-plane tee\n", "X=numpy.array([[a1,0,0],[0,0,0],[0,0,0]]);\n", "#[B]=[b1,b2,b3]\n", "B =S*X\n", "b1=(0.5)**2*a1;#power at port 1\n", "b2=(-0.5)**2*a1;#power at port 2\n", "b3=(0.707)**2*a1;#power at port 3\n", "#Output\n", "print \"Thus b1,b2,b3 are\",b1,\"W,\",b2,\"W,\",round(b3,5),\"W respectively\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Thus b1,b2,b3 are 0.008 W, 0.008 W, 0.016 W respectively\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 6.5, Page number 239" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Chapter-6, Example 6.5, Page 239\n", "#=============================================================================\n", "\n", "#Input parameters\n", "S=([[0.5,-0.5,0.707],[-0.5,0.5,0.707],[0.707,0.707,0]]);\n", "R1=60.;#load at port1 in ohms\n", "R2=75.;#load at port2 in ohms\n", "R3=50.;#characteristic impedance in ohms\n", "P3=20*10**-3;#power at port 3 in Watts\n", "#calculations\n", "p1=(R1-R3)/(R1+R3);\n", "p2=(R2-R3)/(R2+R3);\n", "P1=0.5*P3*(1-(p1)**2);#power delivered to the port1 in Watts\n", "P2=0.5*P3*(1-(p2)**2);#power delivered to the port2 in Watts\n", "#Output\n", "print \"Thus power delivered to the port1 and port2 are\",round(P1,5), \"W,\",P2,\" W respectively\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Thus power delivered to the port1 and port2 are 0.00992 W, 0.0096 W respectively\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 6.7, Page number 240" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Calculate\n", "from numpy import array\n", "\n", "#Variable declaration\n", "Il=0.5 #inserion loss(dB)\n", "Is = 30 #isolation loss(dB)\n", "\n", "#Calculations\n", "#Il = -20log(S21)\n", "S21 = 10**(-Il/20)\n", "#Is = -20log(S12)\n", "S12 = 10**(-Is/20)\n", "#Perfectly matched ports\n", "S11=0\n", "S22=0\n", "\n", "S = array([[S11,S12],[S21,S22]])\n", "\n", "#Result\n", "print \"The scattering matrix is:\\n\",S\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The scattering matrix is:\n", "[[ 0. 0.01 ]\n", " [ 0.94406088 0. ]]\n" ] } ], "prompt_number": 5 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 6.9, Page number 241" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Chapter-6, Example 6.9, Page 241\n", "#=============================================================================\n", "\n", "#Input parameters\n", "ins=0.5;#insertion loss in db\n", "iso=20;#isolation loss in db\n", "S=2;#VSWR \n", "#Calculations\n", "S21=10**-(ins/20.);#insertion loss=0.5=-20*log[S21]\n", "S13=S21;\n", "S32=S13;\n", "S12=10**-(iso/20.);#isolation loss=30=-20*log[s12]\n", "S23=S12;\n", "S31=S23;\n", "p=(S-1)/(S+1);\n", "S11=p;\n", "S22=p;\n", "S33=p;\n", "S=([[S11,S12,S13],[S21,S22,S23],[S31,S32,S33]]);\n", "print S\n", "#for a perfectly matched,non-reciprocal,lossless 3-port circulator,[S] is given by\n", "#[S]=[0,0,S13;S21,0,0;,0,S32,0]\n", "#i.e.,S13=S21=S32=1\n", "#[S]=[0,0,1;1,0,0;0,1,0]" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "[[0, 0.1, 0.9440608762859234], [0.9440608762859234, 0, 0.1], [0.1, 0.9440608762859234, 0]]\n" ] } ], "prompt_number": 6 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 6.10, Page number 242" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Calculate The output power at the port\n", "import math\n", "\n", "#Variable declaration\n", "Pi = 90. #power source(W)\n", "C = 20 #dB\n", "D = 35 #dB\n", "Is = 0.5 #insertion loss(dB)\n", "\n", "#Calculations\n", "#C = 20=10log(Pi/Pf)\n", "Pf = Pi/(10**(20./10.))\n", "#D=350=10log(Pf/Pb)\n", "Pb = Pf/(10**(35./10.))\n", "Pr = Pi-Pf-Pb #received power\n", "Pr_db = 10*math.log10(Pi/Pr)\n", "Pr_dash=Pr_db-Is\n", "\n", "#Result\n", "print \"The output power at the port is\",round(Pr_dash,3),\"dB\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The output power at the port is -0.456 dB\n" ] } ], "prompt_number": 7 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 6.11, Page number 243" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Chapter-6, Example 6.11, Page 242\n", "#=============================================================================\n", "import math\n", "import cmath\n", "from math import sin\n", "from math import cos,log10\n", "#Calculations\n", "S13=0.1*(cos(90*math.pi/180.)+(1j)*sin(90*math.pi/180.));#conversion from polar to rectangular\n", "S13=abs(S13);\n", "C=-20*log10(S13);#coupling coefficient in dB\n", "S14=0.05*(cos(90*math.pi/180.)+(1j)*sin(90*math.pi/180.));#conversion from polar to rectangular\n", "S14=abs(S14);\n", "D=20*log10(S13/S14);#directivity in dB\n", "I=-20*log10(S14);#isolation in dB\n", "print \"Thus coupling,directivity and isolation are\",C,\" dB\",round(D,1),\"dB and\",round(I,0),\"dB respetively \"\n", " " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Thus coupling,directivity and isolation are 20.0 dB 6.0 dB and 26.0 dB respetively \n" ] } ], "prompt_number": 8 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 6.12, Page number 244" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Calculate VSWR\n", "import math\n", "\n", "#Variable declaration\n", "lamda2 = 3.5 #distance between 2 minimas(cm)\n", "lamda_g = 7 #guided wavelength(cm)\n", "d2_1 = 2.5*10**-1 #distance between minimum power points(cm)\n", "\n", "#Calculation\n", "S = lamda_g/(math.pi*d2_1)\n", "\n", "#Result\n", "print \"VSWR =\",round(S,4)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "VSWR = 8.9127\n" ] } ], "prompt_number": 9 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 6.13, Page number 244" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate Phase shift introduced\n", "#chapter-6 page 244 example 6.13\n", "import math\n", "wg=7.2##guide wavelength in cm\n", "x=10.5##Position of reference null without the waveguide component in cm\n", "y=9.3##Position of reference null with the waveguide component in cm\n", "\n", "#CALCULATION\n", "z=x-y##Path difference introduced due to the component in cm\n", "p=(2.*(math.pi)*(z/wg))##Phase difference introduced in rad\n", "Pd=(p*180.)/(math.pi)##Phase shift introduced in deg\n", "\n", "#OUTPUT\n", "print '%s %.2f %s' %('\\nPhase shift introduced is Pd=',Pd,'deg')#\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "\n", "Phase shift introduced is Pd= 60.00 deg\n" ] } ], "prompt_number": 10 } ], "metadata": {} } ] }