summaryrefslogtreecommitdiff
path: root/Microwave_and_Radar_Engineering/Chapter_6.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Microwave_and_Radar_Engineering/Chapter_6.ipynb')
-rw-r--r--Microwave_and_Radar_Engineering/Chapter_6.ipynb546
1 files changed, 546 insertions, 0 deletions
diff --git a/Microwave_and_Radar_Engineering/Chapter_6.ipynb b/Microwave_and_Radar_Engineering/Chapter_6.ipynb
new file mode 100644
index 00000000..cd9f5cb9
--- /dev/null
+++ b/Microwave_and_Radar_Engineering/Chapter_6.ipynb
@@ -0,0 +1,546 @@
+{
+ "metadata": {
+ "name": "Chapter 6"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 6: Microwave components"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.2, Page number 234"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''Calculating the distance between S12 and S21'''\n",
+ "\n",
+ "from numpy import array\n",
+ "import cmath\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "S = array([[0,0.3+0.4j], [0.3+0.4j, 0]], dtype=complex)\n",
+ "B = 34.3 #rad/sec\n",
+ "\n",
+ "#Calculations\n",
+ "'''Let port 1 be shifted by phi-1 gegrees to the lfet and port 2 remain unchanged\n",
+ "phi-1 = [[e^(-j*phi-1), 0]\n",
+ " [0 1]]\n",
+ "Solving [S-dash]=[phi]*[S]*[phi], we get,'''\n",
+ "phi1 = 53.13\n",
+ "l = math.radians(phi1)/B\n",
+ "\n",
+ "#Result\n",
+ "print \"The distance is\",round(l,5),\"m\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The distance is 0.02703 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.3, Page number 236"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''Determine the scattering parameters'''\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "D = 30 #directiviy(dB)\n",
+ "s = 1 #VSWR\n",
+ "\n",
+ "#Calculations\n",
+ "#since C = -10*log(p1/p4),therefore,\n",
+ "S41 = math.sqrt(0.1)\n",
+ "S14=S41 #as matched and lossless\n",
+ "\n",
+ "#Now, D = 10*log(p4/p3)\n",
+ "S31=math.sqrt(S41**2/10**3)\n",
+ "S13=S31\n",
+ "\n",
+ "S11 = ((s-1)/(s+1))\n",
+ "S22=S11\n",
+ "S33=S11\n",
+ "S44=S11\n",
+ "\n",
+ "#Let input power be given at port 1\n",
+ "S21 = math.sqrt(1-S31**2-S41**2)\n",
+ "S12=S21\n",
+ "\n",
+ "S34 = math.sqrt((1+S12**2-10**-1-10**-4)*0.5)\n",
+ "S43=S34\n",
+ "\n",
+ "S23 = math.sqrt(1-10**-4-S34**2)\n",
+ "S32=S23\n",
+ "\n",
+ "S24 = math.sqrt(1-10**-1-S34**2)\n",
+ "S42=S24\n",
+ "\n",
+ "S = array([[S11,S12,S13,S14],[S21,S22,S23,S24],[S31,S32,S33,S34],[S41,S42,S43,S44]])\n",
+ "\n",
+ "#Result\n",
+ "print \"The required S-parameters are:\\n\\n\",S"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The required S-parameters are:\n",
+ "\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": 39
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.4, Page number 238"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''Determining the power in remaining ports when other ports are terminated'''\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "a1 = 32 #signal power(mW) to port 1\n",
+ "a2 = 0 #power fed to port 2\n",
+ "a3 = 0 #power fed to port 3\n",
+ "s = array([[0.5,-0.5,math.sqrt(0.5)],[-0.5,0.5,math.sqrt(0.5)],[math.sqrt(0.5),math.sqrt(0.5),0]]) #s-matrix for H-plane Tee\n",
+ "\n",
+ "#Calculations\n",
+ "p = array([a1,a2,a3])\n",
+ "b = (s**2)*p\n",
+ "print \"[b]=\\n\",b\n",
+ "\n",
+ "#Results\n",
+ "print \"\\nPower at port 1 =\",b[0,0],\"mW\"\n",
+ "print \"Power at port 2 =\",b[1,0],\"mW\"\n",
+ "print \"Power at port 3 =\",b[2,0],\"mW\"\n",
+ "print \"It can be seen that b3=b1+b2\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "[b]=\n",
+ "[[ 8. 0. 0.]\n",
+ " [ 8. 0. 0.]\n",
+ " [ 16. 0. 0.]]\n",
+ "\n",
+ "Power at port 1 = 8.0 mW\n",
+ "Power at port 2 = 8.0 mW\n",
+ "Power at port 3 = 16.0 mW\n",
+ "It can be seen that b3=b1+b2\n"
+ ]
+ }
+ ],
+ "prompt_number": 59
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.5, Page number 239"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''Calculate power delivered to the loads connected to ports 1 & 2'''\n",
+ "\n",
+ "from numpy import array\n",
+ "\n",
+ "#Variable declaration\n",
+ "s = array([[0.5,-0.5,math.sqrt(0.5)],[-0.5,0.5,math.sqrt(0.5)],[math.sqrt(0.5),math.sqrt(0.5),0]]) #s-matrix for H-plane Tee\n",
+ "b1=10*10**-3 #power at port 1\n",
+ "b2=10*10**-3 #power at port 2\n",
+ "\n",
+ "#Calculations\n",
+ "rho1=(60.-50.)/(60.+50.)\n",
+ "rho2=(75.-50.)/(75.+50.)\n",
+ "P1=0.5*b1**2*(1-rho1**2)\n",
+ "P2=0.5*b2**2*(1-rho2**2)\n",
+ "\n",
+ "#Results\n",
+ "print \"The solution given in the textbook is incorrect.\\n\"\n",
+ "print \"Power delivered to port 1 =\",round((P1/1E-3),3),\"mW\"\n",
+ "print \"Power delivered to port 2 =\",round((P2/1E-3),3),\"mW\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The solution given in the textbook is incorrect.\n",
+ "\n",
+ "Power delivered to port 1 = 0.05 mW\n",
+ "Power delivered to port 2 = 0.048 mW\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.7, Page number 240"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''Determine scattering matrix of the isolator'''\n",
+ "\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": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.9, Page number 241"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''Determining the [S] of a 3-port circulator'''\n",
+ "\n",
+ "from numpy import array\n",
+ "\n",
+ "#Variable declaration\n",
+ "Il= 0.5 #inserion loss(dB)\n",
+ "Is = 20 #isolation loss(dB)\n",
+ "S = 2 #VSWR\n",
+ "\n",
+ "#Calculations\n",
+ "#Il = -20log(S21)\n",
+ "S21 = 10**(-Il/20)\n",
+ "#For circulator,\n",
+ "S32=S21\n",
+ "S13=S21\n",
+ "\n",
+ "#Is = -20log(S12)\n",
+ "S12 = 10**(-Is/20)\n",
+ "#For circulator,\n",
+ "S23=S12\n",
+ "S31=S12\n",
+ "\n",
+ "rho = (S-1.)/(S+1.)\n",
+ "#For circulator,\n",
+ "S11=rho\n",
+ "S22=rho\n",
+ "S33=rho\n",
+ "\n",
+ "#Results\n",
+ "S = array([[S11,S12,S13],[S21,S22,S23],[S31,S32,S33]])\n",
+ "print \"[S]=\\n\",S\n",
+ "#For a perfectly matched, non-reciprocal, lossless 3-port circulator, [s] is given by,\n",
+ "''' [S] = [[0 0 S13]\n",
+ " [S21 0 0 ]\n",
+ " [0 S32 0 ]]'''\n",
+ "#The terminal planes are such that phase angles of S13=S21=S32=1\n",
+ "S13_new=1\n",
+ "S21_new=1\n",
+ "S32_new=1\n",
+ "S_new = array([[0,0,S13_new],[S21_new,0,0],[0,S32_new,0]])\n",
+ "print \"\\nThe scattering matrix now becomes [S]=\\n\",S_new"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "[S]=\n",
+ "[[ 0.33333333 0.1 0.94406088]\n",
+ " [ 0.94406088 0.33333333 0.1 ]\n",
+ " [ 0.1 0.94406088 0.33333333]]\n",
+ "\n",
+ "The scattering matrix now becomes [S]=\n",
+ "[[0 0 1]\n",
+ " [1 0 0]\n",
+ " [0 1 0]]\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.10, Page number 242\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''Finding the output power at the ports'''\n",
+ "\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": 34
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.11, Page number 243"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''Finding the directivity, coupling and islotaion for a directional coupler'''\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "'''\n",
+ "[S] = [[0.05/_30 0.96/_0 0.1/_90 0.05/_90]\n",
+ " [0.96/_0 0.05/_30 0.05/_90 0.1/_90 ]\n",
+ " [0.1/_90 0.05/_90 0.05/_30 0.96/_0 ]\n",
+ " [0.05/_90 0.1/_90 0.96/_0 0.05/_30]]\n",
+ "'''\n",
+ "\n",
+ "#Calculations\n",
+ "#Coupling = C=10log(P1/P3)=-20log|S13|\n",
+ "C = -20*math.log10(0.1)\n",
+ "#Directivity = D=10log(P3/P4)=20log(|S13|/|S14|)\n",
+ "D = 20*math.log10(0.1/0.05)\n",
+ "#Isolation =I=10log(P3/P4)=10log(P1/P4)=-20log|S14|\n",
+ "I = -20*math.log10(0.05)\n",
+ "\n",
+ "#Results\n",
+ "print \"Coupling =\",C,\"dB\"\n",
+ "print \"Directivity =\",round(D,2),\"dB\"\n",
+ "print \"Isolation =\",round(I,2),\"dB\"\n",
+ "\n",
+ " "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Coupling = 20.0 dB\n",
+ "Directivity = 6.02 dB\n",
+ "Isolation = 26.02 dB\n"
+ ]
+ }
+ ],
+ "prompt_number": 43
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.12, Page number 244"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''Determining VSWR'''\n",
+ "\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": 46
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.13, Page number 244"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''Determining the phase shift component in a phase shift measurement setup'''\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda_g = 7.2 #guided wavelength(cm)\n",
+ "rn = 10.5 #position of reference null(cm)\n",
+ "rn_new = 9.3 #new position of reference null due to component(cm)\n",
+ "\n",
+ "#Calculations\n",
+ "pd = rn - rn_new #path difference due to component(cm)\n",
+ "ps = (2*math.pi*pd)/lamda_g #phase shift introduced\n",
+ "\n",
+ "#Result\n",
+ "print \"The phase shift component is\",round(ps,3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The phase shift component is 1.047\n"
+ ]
+ }
+ ],
+ "prompt_number": 48
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file