"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"from __future__ import division\n",
"import math\n",
"import cmath\n",
"#initializing the variables:\n",
"R1 = 1000;# in ohm\n",
"R2 = 2000;# in ohm\n",
"R3 = 3000;# in ohm\n",
"I1 = 1;# in amperes (lets say)\n",
"\n",
"#calculation:\n",
" #image impedance Roa\n",
"Roa = (((R3 + R2)*R1/(R1 + R2 + R3))*(R1*R3/(R1 + R3)))**0.5\n",
" #image impedance Rob\n",
"Rob = (((R3 + R1)*R2/(R1 + R2 + R3))*(R2*R3/(R2 + R3)))**0.5\n",
" #The iterative impedance at port 1\n",
"Ri1 = (-1*R1 + ((R1**2) - (-1*4*2*R2*R1))**0.5)/(2*2)\n",
" #The iterative impedance at port 2\n",
"Ri2 = (R1 + ((-1*R1)**2 - (-1*4*2*R2*R1))**0.5)/(2*2)\n",
"\n",
"\n",
"#Results\n",
"print \"\\n\\n Result \\n\\n\"\n",
"print \"\\n image impedance are \",round(Roa,2),\" ohm and \",round(Rob,2),\" ohm \"\n",
"print \"\\n iterative impedances are \",round(Ri1,2),\" ohm and \",round(Ri2,2),\" ohm \""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"\n",
" Result \n",
"\n",
"\n",
"\n",
" image impedance are 790.57 ohm and 1264.91 ohm \n",
"\n",
" iterative impedances are 780.78 ohm and 1280.78 ohm "
]
}
],
"prompt_number": 11
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
Example 15, page no. 780
"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"from __future__ import division\n",
"import math\n",
"import cmath\n",
"#initializing the variables:\n",
"r = 500;# in ohm\n",
"RL = 100;# in ohm\n",
"E = 1;# in volts (lets say)\n",
"\n",
"#calculation:\n",
" #res.\n",
"R1 = (r*(r - RL))**0.5\n",
"R2 = (r*RL**2/(r - RL))**0.5\n",
" #current I1\n",
"I1 = E/(r + R1 + R2*RL/(RL + R2))\n",
" #current I2\n",
"I2 = (R2/(R2 + RL))*I1\n",
" #input power\n",
"P1 = r*I1**2\n",
" #output power\n",
"P2 = RL*I2**2\n",
" #attenuation\n",
"attn = 10*(1/2.303)*math.log(P1/P2)\n",
" #Load current, IL\n",
"IL = E/(r + RL)\n",
" #voltage, VL\n",
"VL = IL*RL\n",
" #voltage, V1\n",
"V1 = E - I1*r\n",
" #voltage, V2\n",
"V2 = V1 - I1*R1\n",
" #insertion loss\n",
"il = 20*(1/2.303)*math.log(VL/V2)\n",
"\n",
"\n",
"#Results\n",
"print \"\\n\\n Result \\n\\n\"\n",
"print \"\\n R1 = \",round(R1,2),\" ohm and R2 = \",round(R2,2),\" ohm \"\n",
"print \"\\n attenuation is \",round(attn,2),\" dB \"\n",
"print \"\\n In decibels, the insertion loss is \",round(il,2),\" dB \""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"\n",
" Result \n",
"\n",
"\n",
"\n",
" R1 = 447.21 ohm and R2 = 111.8 ohm \n",
"\n",
" attenuation is 12.54 dB \n",
"\n",
" In decibels, the insertion loss is 9.98 dB "
]
}
],
"prompt_number": 12
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
Example 16, page no. 783
"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"from __future__ import division\n",
"import math\n",
"import cmath\n",
"#initializing the variables:\n",
"attnO = 70;# in dB\n",
"n = 5;# numbers of identical atteneurs\n",
"V1 = 0.02;# in Volts\n",
"\n",
"#calculation:\n",
" #attenuation of each section\n",
"attn = attnO/n\n",
" #output of the final stage\n",
"Vo = V1/(10**(attnO/20))\n",
" #voltage output of the third stage\n",
"V3 = V1/(10**(3*attn/20))\n",
"\n",
"\n",
"#Results\n",
"print \"\\n\\n Result \\n\\n\"\n",
"print \"\\n attenuation of each section = \",round(attn,2),\" dB \"\n",
"print \"\\n output of the final stage is \",round(Vo*1E6,2),\"uV \"\n",
"print \"\\n voltage output of the third stage is \",round(V3*1E3,3),\"mV \""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"\n",
" Result \n",
"\n",
"\n",
"\n",
" attenuation of each section = 14.0 dB \n",
"\n",
" output of the final stage is 6.32 uV \n",
"\n",
" voltage output of the third stage is 0.159 mV "
]
}
],
"prompt_number": 1
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
Example 17, page no. 784
"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"from __future__ import division\n",
"import math\n",
"import cmath\n",
"#initializing the variables:\n",
"r = 450; # in ohm\n",
"R0 = 450; # in ohms\n",
"x = 1/8\n",
"\n",
"#calculation:\n",
"N = 1/x\n",
"R1 = R0*(N-1)/(N+1)\n",
"R2 = R0*2*N/(N**2 - 1)\n",
"\n",
"Io = x*x\n",
"\n",
"attn = 20*math.log10(N)\n",
"attnO = 4*attn\n",
"\n",
"#Results\n",
"print \"\\n\\n Result \\n\\n\"\n",
"print \"\\n (a)For a T-section symmetrical attenuator pad, Resistance R1 is\",round(R1,2),\" ohm \"\n",
"print \"and Resistance R2 is\",round(R2,0),\" ohm\"\n",
"print \"\\n (b)current flows in the load = \",round(Io,2),\"of the original current.\"\n",
"print \"\\n (c)overall attenuation is \",round(attnO,2),\"dB \""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"\n",
" Result \n",
"\n",
"\n",
"\n",
" (a)For a T-section symmetrical attenuator pad, Resistance R1 is 350.0 ohm \n",
"and Resistance R2 is 114.0 ohm\n",
"\n",
" (b)current flows in the load = 0.02 of the original current.\n",
"\n",
" (c)overall attenuation is 72.25 dB \n"
]
}
],
"prompt_number": 5
}
],
"metadata": {}
}
]
}