| 1 |
{ |
| 2 |
"cells": [ |
| 3 |
{ |
| 4 |
"cell_type": "markdown", |
| 5 |
"metadata": {}, |
| 6 |
"source": [ |
| 7 |
"# Properties of RG-58" |
| 8 |
] |
| 9 |
}, |
| 10 |
{ |
| 11 |
"cell_type": "markdown", |
| 12 |
"metadata": {}, |
| 13 |
"source": [ |
| 14 |
"This example demonstrates how to use skrf's to explore some properties of Coax (RG-58). This is done through the `media` package which provides basic transmission line models. Specifically, the coax is created using by `DistributedCircuit`." |
| 15 |
] |
| 16 |
}, |
| 17 |
{ |
| 18 |
"cell_type": "code", |
| 19 |
"execution_count": null, |
| 20 |
"metadata": { |
| 21 |
"scrolled": false |
| 22 |
}, |
| 23 |
"outputs": [], |
| 24 |
"source": [ |
| 25 |
"import matplotlib.pyplot as plt\n", |
| 26 |
"import numpy as np\n", |
| 27 |
"\n", |
| 28 |
"import skrf as rf\n", |
| 29 |
"from skrf.media import DistributedCircuit\n", |
| 30 |
"from skrf.plotting import func_on_all_figs as foaf\n", |
| 31 |
"\n", |
| 32 |
"%matplotlib inline\n", |
| 33 |
"\n", |
| 34 |
"rf.stylely()\n", |
| 35 |
"\n", |
| 36 |
"\n", |
| 37 |
"\n", |
| 38 |
"# define a frequency object from a vector\n", |
| 39 |
"freq = rf.F.from_f(np.logspace(0,6,1001), unit='hz')\n", |
| 40 |
"\n", |
| 41 |
"# create a Media object for RG-58, based on distributed ckt values\n", |
| 42 |
"rg58 = DistributedCircuit(\n", |
| 43 |
" frequency = freq,\n", |
| 44 |
" C =93.5e-12,#F/m\n", |
| 45 |
" L =273e-9, #H/m\n", |
| 46 |
" R =0,#53e-3, #Ohm/m\n", |
| 47 |
" G =0, #S/m\n", |
| 48 |
" )\n", |
| 49 |
"\n", |
| 50 |
"\n", |
| 51 |
"# loop thru values of resistivity plot various quantities\n", |
| 52 |
"for k in (0,.1,1,10,100):\n", |
| 53 |
" rg58.R = k*1e-3\n", |
| 54 |
"\n", |
| 55 |
" plt.figure(0)\n", |
| 56 |
" plt.ylabel('Phase Velocity (m/us)')\n", |
| 57 |
" plt.title('Phase Velocity')\n", |
| 58 |
" plt.loglog(freq.f_scaled, rg58.v_p*1e-6, label=rf'{k:.1e} $m \\Omega/m $')\n", |
| 59 |
"\n", |
| 60 |
" plt.figure(1)\n", |
| 61 |
" plt.ylabel('Real($Z_0$)')\n", |
| 62 |
" plt.title('Characteristic Impedance (Real)')\n", |
| 63 |
" plt.loglog(freq.f_scaled, rg58.z0.real, label=rf'{k:.1e} $m \\Omega/m $')\n", |
| 64 |
"\n", |
| 65 |
" plt.figure(2)\n", |
| 66 |
" plt.ylabel('-Imag($Z_0$)')\n", |
| 67 |
" plt.title('Characteristic Impedance (Imag)')\n", |
| 68 |
" plt.plot(freq.f_scaled, -1*rg58.z0.imag, label=rf'{k:.1e} $m \\Omega/m $')\n", |
| 69 |
"\n", |
| 70 |
" plt.figure(3)\n", |
| 71 |
" plt.ylabel(r'Real($\\gamma$)')\n", |
| 72 |
" plt.title('Propagation Constant (Real)')\n", |
| 73 |
" plt.plot(freq.f_scaled, rg58.alpha, label=rf'{k:.1e} $m \\Omega/m $')\n", |
| 74 |
"\n", |
| 75 |
" plt.figure(4)\n", |
| 76 |
" plt.ylabel(r'Imag($\\gamma$)')\n", |
| 77 |
" plt.title('Propagation Constant (Imag)')\n", |
| 78 |
" plt.plot(freq.f_scaled, rg58.beta, label=rf'{k:.1e} $m \\Omega/m $')\n", |
| 79 |
"\n", |
| 80 |
"\n", |
| 81 |
"\n", |
| 82 |
"\n", |
| 83 |
"\n", |
| 84 |
"foaf(freq.labelXAxis)\n", |
| 85 |
"foaf(plt.tight_layout)\n", |
| 86 |
"foaf(plt.legend)\n", |
| 87 |
"foaf(plt.loglog)\n", |
| 88 |
"\n", |
| 89 |
"plt.tight_layout()\n" |
| 90 |
] |
| 91 |
}, |
| 92 |
{ |
| 93 |
"cell_type": "code", |
| 94 |
"execution_count": null, |
| 95 |
"metadata": {}, |
| 96 |
"outputs": [], |
| 97 |
"source": [] |
| 98 |
} |
| 99 |
], |
| 100 |
"metadata": { |
| 101 |
"anaconda-cloud": {}, |
| 102 |
"kernelspec": { |
| 103 |
"display_name": "Python 3", |
| 104 |
"language": "python", |
| 105 |
"name": "python3" |
| 106 |
}, |
| 107 |
"language_info": { |
| 108 |
"codemirror_mode": { |
| 109 |
"name": "ipython", |
| 110 |
"version": 3 |
| 111 |
}, |
| 112 |
"file_extension": ".py", |
| 113 |
"mimetype": "text/x-python", |
| 114 |
"name": "python", |
| 115 |
"nbconvert_exporter": "python", |
| 116 |
"pygments_lexer": "ipython3", |
| 117 |
"version": "3.8.10" |
| 118 |
} |
| 119 |
}, |
| 120 |
"nbformat": 4, |
| 121 |
"nbformat_minor": 1 |
| 122 |
} |