summaryrefslogtreecommitdiff
path: root/Microwave_Engineering_by_G._S._Raghuvanshi/Ch3.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Microwave_Engineering_by_G._S._Raghuvanshi/Ch3.ipynb')
-rw-r--r--Microwave_Engineering_by_G._S._Raghuvanshi/Ch3.ipynb258
1 files changed, 258 insertions, 0 deletions
diff --git a/Microwave_Engineering_by_G._S._Raghuvanshi/Ch3.ipynb b/Microwave_Engineering_by_G._S._Raghuvanshi/Ch3.ipynb
new file mode 100644
index 00000000..58613139
--- /dev/null
+++ b/Microwave_Engineering_by_G._S._Raghuvanshi/Ch3.ipynb
@@ -0,0 +1,258 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:cae0ff7581c3b5c12e11b4f1b44c3beb02347fef7d7d6837104f81f1c4303c1b"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Ch-3 : Microwave Network Analysis"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Page Number: 142 Example 3.4"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from numpy import array, linalg, mat, set_printoptions\n",
+ "\n",
+ "#Given\n",
+ "\n",
+ "z=mat('[4 2 ;2 4]')\n",
+ "I=mat('[1 0;0 1]') \n",
+ "\n",
+ "\n",
+ "#Scattering matrix\n",
+ "s=(z-I)*linalg.inv(z+I)\n",
+ "set_printoptions(precision=3)\n",
+ "print 'Scattering Matrix:\\n' ,s"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Scattering Matrix:\n",
+ "[[ 0.524 0.19 ]\n",
+ " [ 0.19 0.524]]\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Page Number: 142 Example 3.5"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import sqrt, pi \n",
+ "from cmath import exp\n",
+ "#Given\n",
+ "P=12.8e-3 #W\n",
+ "l=3 #cm\n",
+ "lamb=4.2 #cm\n",
+ "vswr=2.2 \n",
+ "jfi=1J*4.49 \n",
+ "\n",
+ "#ap\n",
+ "ap=sqrt(2*P) \n",
+ "\n",
+ "#Phase shift\n",
+ "bl=(2*pi*l)/lamb \n",
+ "#bp\n",
+ "bp=(ap*(vswr-1))/(vswr+1) \n",
+ "\n",
+ "a=ap*exp(jfi) \n",
+ "b=bp*exp(jfi) \n",
+ "print 'Required Waves:\\n{:.3}'.format(a),'\\n{:.3}'.format(b)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Required Waves:\n",
+ "(-0.0353-0.156j) \n",
+ "(-0.0132-0.0585j)\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Page Number: 143 Example 3.6"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " from math import log10\n",
+ "#Given\n",
+ "S11=0.10 \n",
+ "S12=0.90 \n",
+ "A12=-45 \n",
+ "S21=0.90 \n",
+ "A21=45 \n",
+ "S22=0.3 \n",
+ "\n",
+ "#(i) Network is reciprocal\n",
+ "if(A12==A21):\n",
+ " print 'Network is reciprocal' \n",
+ "else:\n",
+ " \n",
+ " print 'Network is not reciprocal' \n",
+ "\n",
+ "\n",
+ "#(ii) Network is lossles\n",
+ "x=(S11**2)+(S12**2) \n",
+ "if(x==1):\n",
+ " print 'Network is lossless' \n",
+ "else:\n",
+ " \n",
+ " print 'Network is not lossless' \n",
+ "\n",
+ "\n",
+ "#(iii)Return loss\n",
+ "T=S11-((S12*S21)/(1+S22)) \n",
+ "Tm=-T #mod of T\n",
+ "L=-20*log10(Tm) \n",
+ "print 'Return Loss: %0.3f'%L,'dB'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Network is not reciprocal\n",
+ "Network is not lossless\n",
+ "Return Loss: 5.629 dB\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Page Number: 163 Example 3.12"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Given\n",
+ "S11=0.6 \n",
+ "S12=0.045 \n",
+ "S21=2.5 \n",
+ "S22=0.50 \n",
+ "TS=0.5 \n",
+ "TL=0.4 \n",
+ "Z0=50 #ohm\n",
+ "Vrms=10 #V\n",
+ "\n",
+ "#(i) Gain Parameters\n",
+ "#(i)Reflection coefficients of input and output\n",
+ "Tin=S11+((S12*S21*TL)/(1-(S22*TL))) \n",
+ "Tout=S22+((S12*S21*TS)/(1-(S22*TS))) \n",
+ "\n",
+ "#Transducer Gain\n",
+ "x=(1-(TS)**2)/((1-(S11*TS))**2) \n",
+ "y=(S21*S21) \n",
+ "z=(1-(TL)**2)/((1-(Tout*TL))**2) \n",
+ "GT=x*y*z \n",
+ "print 'Transducer Gain: %0.3f'%GT\n",
+ "\n",
+ "#Available Power Gain\n",
+ "z1=1-(Tout)**2 \n",
+ "GA=(x*y)/z1 \n",
+ "print 'Available power Gain: %0.3f'%GA\n",
+ "\n",
+ "#Power Gain\n",
+ "z2=1-(Tin)**2 \n",
+ "GP=(x*y)/z2 \n",
+ "print 'Power Gain: %0.3f'%GP\n",
+ "\n",
+ "#(ii) Power levels\n",
+ "#Power available at source\n",
+ "Pavs=(sqrt(2)*Vrms)**2/(8*Z0) \n",
+ "print 'Power available at source: %0.3f'%Pavs,'W'\n",
+ "\n",
+ "Pl=9.4*Pavs \n",
+ "#Power available at input\n",
+ "Pin=Pl/13.5 \n",
+ "print 'Power available at input: %0.3f'%Pin,'W'\n",
+ "\n",
+ "#(iii) VSWRs\n",
+ "M1=Pin/Pavs \n",
+ "M2=Pl/(9.6*Pavs) \n",
+ "\n",
+ "Tin1=sqrt(1-M1) \n",
+ "Tout1=sqrt(1-M2) \n",
+ "\n",
+ "vswrin=(1+Tin1)/(1-Tin1) \n",
+ "print 'Input VSWR: %0.3f'%vswrin\n",
+ "vswrout=(1+Tout1)/(1-Tout1) \n",
+ "print 'Output VSWR: %0.3f'%vswrout\n",
+ "\n",
+ "#Calculations for gain are done wrong in book, hence answers dont match"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Transducer Gain: 13.553\n",
+ "Available power Gain: 14.291\n",
+ "Power Gain: 16.803\n",
+ "Power available at source: 0.500 W\n",
+ "Power available at input: 0.348 W\n",
+ "Input VSWR: 3.455\n",
+ "Output VSWR: 1.337\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file