summaryrefslogtreecommitdiff
path: root/sample_notebooks/Hrituraj/Ch-6.ipynb
diff options
context:
space:
mode:
authorTrupti Kini2016-03-20 23:30:12 +0600
committerTrupti Kini2016-03-20 23:30:12 +0600
commit03dcbf0b11d1414a91d838aded9e61a307a74b0b (patch)
tree445e5ee8a5202c58271064b7af892fb129cea16c /sample_notebooks/Hrituraj/Ch-6.ipynb
parentfbf7bfe3ae79ca0913b5ed72666546284798450b (diff)
downloadPython-Textbook-Companions-03dcbf0b11d1414a91d838aded9e61a307a74b0b.tar.gz
Python-Textbook-Companions-03dcbf0b11d1414a91d838aded9e61a307a74b0b.tar.bz2
Python-Textbook-Companions-03dcbf0b11d1414a91d838aded9e61a307a74b0b.zip
Added(A)/Deleted(D) following books
A Engineering_Physics_by_Prabir_K_Basu_&_Hrishikesh_Dhasmana/Chapter1__1.ipynb A Engineering_Physics_by_Prabir_K_Basu_&_Hrishikesh_Dhasmana/Chapter2_2.ipynb A Engineering_Physics_by_Prabir_K_Basu_&_Hrishikesh_Dhasmana/Chapter3_2.ipynb A Engineering_Physics_by_Prabir_K_Basu_&_Hrishikesh_Dhasmana/Chapter4&5_2.ipynb A Engineering_Physics_by_Prabir_K_Basu_&_Hrishikesh_Dhasmana/Chapter6_2.ipynb A Engineering_Physics_by_Prabir_K_Basu_&_Hrishikesh_Dhasmana/Chapter7_2.ipynb A Engineering_Physics_by_Prabir_K_Basu_&_Hrishikesh_Dhasmana/Chapter8_2.ipynb A Engineering_Physics_by_Prabir_K_Basu_&_Hrishikesh_Dhasmana/Chapter9_2.ipynb A Engineering_Physics_by_Prabir_K_Basu_&_Hrishikesh_Dhasmana/screenshots/Screenshot_(1)_2.png A Engineering_Physics_by_Prabir_K_Basu_&_Hrishikesh_Dhasmana/screenshots/Screenshot_(2)_2.png A Engineering_Physics_by_Prabir_K_Basu_&_Hrishikesh_Dhasmana/screenshots/Screenshot_(3)_2.png A sample_notebooks/Hrituraj/Ch-6.ipynb A "sample_notebooks/Nitin Kumar/Chap3.ipynb" A sample_notebooks/SaleemAhmed/Chapter10.ipynb A sample_notebooks/VineshSaini/Ch1.ipynb
Diffstat (limited to 'sample_notebooks/Hrituraj/Ch-6.ipynb')
-rw-r--r--sample_notebooks/Hrituraj/Ch-6.ipynb540
1 files changed, 540 insertions, 0 deletions
diff --git a/sample_notebooks/Hrituraj/Ch-6.ipynb b/sample_notebooks/Hrituraj/Ch-6.ipynb
new file mode 100644
index 00000000..63e7e1c5
--- /dev/null
+++ b/sample_notebooks/Hrituraj/Ch-6.ipynb
@@ -0,0 +1,540 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Ch-6 : Frequency response, bode plots and resonance"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example: 6.1 Page No: 476"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 18,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "peak value of Vout = 6.00 volts\n",
+ "phase angle of Vout = 70.00 degrees\n",
+ "with frequency equal to = 1000.00\n"
+ ]
+ }
+ ],
+ "source": [
+ "from math import pi, cos, sin, atan, sqrt\n",
+ "# given V_in(t)=2*cos(2000*pi*t+A), A=40*pi/180\n",
+ "w=2000*pi# #omega\n",
+ "f=w/(2*pi)# #frequency\n",
+ "A=40*pi/180# #40 degrees = %0.2f radians\n",
+ "#equation of straight line of H_magnitude vs f is x+1000*y-4000=0\n",
+ "H_max=(4000-f)/1000# #magnitude of H(traansfer function)\n",
+ "#equation of straight line of H_phase angle vs f is 6000*y=pi*x (phase angle = %0.2f radians)\n",
+ "H_phi=pi*f/6000# #phase angle of H\n",
+ "H=H_max*complex(cos(H_phi),sin(H_phi))\n",
+ "V_in=2*complex(cos(A),sin(A))# #input voltage phasor\n",
+ "V_out=H*V_in# #output voltage phasor\n",
+ "V_out_R=(V_out.real)# #real part\n",
+ "V_out_I=(V_out.imag)# #imaginary part\n",
+ "V_out_max=sqrt((V_out_R**2)+(V_out_I**2))# #peak value\n",
+ "V_out_phi=atan(V_out_I/V_out_R)\n",
+ "print 'peak value of Vout = %0.2f volts'%V_out_max\n",
+ "print 'phase angle of Vout = %0.2f degrees'%(V_out_phi*180/pi)\n",
+ "print 'with frequency equal to = %0.2f'%f"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example: 6.2 Page No: 477"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Output voltage is Vout1+Vout2+Vout3 where\n",
+ "\n",
+ "FOR Vout1:\n",
+ "peak value = 12.00 volts\n",
+ "phase angle = 0.00 degrees\n",
+ "with frequency = 0.00 hertz\n",
+ "\n",
+ "FOR Vout2:\n",
+ "peak value = 6.00 volts\n",
+ "phase angle = 30.00 degrees\n",
+ "with frequency = 1000.00 hertz\n",
+ "\n",
+ "FOR Vout3:\n",
+ "peak value = 2.00 volts\n",
+ "phase angle = -10.00 degrees\n",
+ "with frequency = 2000.00 hertz\n"
+ ]
+ }
+ ],
+ "source": [
+ "from __future__ import division\n",
+ "#given V_in(t)=3+2*cos(2000*pi*t)+cos(4000*pi*t-A), A=70*pi/180\n",
+ "#the three parts of V_in(t) are V_in_1=3, V_in_2=2*cos(2000*pi*t),V_in_3=cos(4000*pi*t-A)\n",
+ "\n",
+ "#first component V_1\n",
+ "V_in_1=3\n",
+ "f_1=0# #as omega is zero\n",
+ "#equation of straight line of H_magnitude vs f is x+1000*y-4000=0\n",
+ "H_1_max=(4000-f_1)/1000# #magnitude of H(traansfer function)\n",
+ "#equation of straight line of H_phase angle vs f is 6000*y=pi*x (phase angle = %0.2f radians)\n",
+ "H_1_phi=pi*f_1/6000# #phase angle of H\n",
+ "H_1=H_1_max*complex(cos(H_1_phi),sin(H_1_phi))\n",
+ "V_out_1=H_1*V_in_1\n",
+ "V_out_1_R=(V_out_1).real# #real part\n",
+ "V_out_1_I=(V_out_1).imag# #imaginary part\n",
+ "V_out_1_max=sqrt((V_out_1_R**2)+(V_out_1_I**2))# #peak value\n",
+ "V_out_1_phi=atan(V_out_1_I/V_out_1_R)# #phase angle\n",
+ "\n",
+ "#second component V_in_2\n",
+ "V_in_2=2*complex(cos(0),sin(0))# #V_in_2 phasor\n",
+ "w=2000*pi# #omega\n",
+ "f_2=w/(2*pi)# #frequency\n",
+ "#equation of straight line of H_magnitude vs f is x+1000*y-4000=0\n",
+ "H_2_max=(4000-f_2)/1000# #magnitude of H(traansfer function)\n",
+ "#equation of straight line of H_phase angle vs f is 6000*y=pi*x (phase angle = %0.2f radians)\n",
+ "H_2_phi=pi*f_2/6000# #phase angle of H\n",
+ "H_2=H_2_max*complex(cos(H_2_phi),sin(H_2_phi))\n",
+ "V_out_2=H_2*V_in_2\n",
+ "V_out_2_R=(V_out_2).real# #real part\n",
+ "V_out_2_I=(V_out_2).imag# #imaginary part\n",
+ "V_out_2_max=sqrt((V_out_2_R**2)+(V_out_2_I**2))# #peak value\n",
+ "V_out_2_phi=atan(V_out_2_I/V_out_2_R)# #phase angle\n",
+ "\n",
+ "#third component\n",
+ "A=-70*pi/180# #-70 degrees = %0.2f radians\n",
+ "V_in_3=complex(cos(A),sin(A))# #V_in_3 phasor\n",
+ "w=4000*pi# #omega\n",
+ "f_3=w/(2*pi)# #frequency\n",
+ "#equation of straight line of H_magnitude vs f is x+1000*y-4000=0\n",
+ "H_3_max=(4000-f_3)/1000# #magnitude of H(traansfer function)\n",
+ "#equation of straight line of H_phase angle vs f is 6000*y=pi*x (phase angle = %0.2f radians)\n",
+ "H_3_phi=pi*f_3/6000# #phase angle of H\n",
+ "H_3=H_3_max*complex(cos(H_3_phi),sin(H_3_phi))\n",
+ "V_out_3=H_3*V_in_3\n",
+ "V_out_3_R=(V_out_3).real# #real part\n",
+ "V_out_3_I=(V_out_3).imag# #imaginary part\n",
+ "V_out_3_max=sqrt((V_out_3_R**2)+(V_out_3_I**2))# #peak value\n",
+ "V_out_3_phi=atan(V_out_3_I/V_out_3_R)# #phase angle\n",
+ "\n",
+ "print 'Output voltage is Vout1+Vout2+Vout3 where'\n",
+ "print ''\n",
+ "print 'FOR Vout1:'\n",
+ "print 'peak value = %0.2f volts'%V_out_1_max\n",
+ "print 'phase angle = %0.2f degrees'%(V_out_1_phi*180/pi)\n",
+ "print 'with frequency = %0.2f hertz'%f_1\n",
+ "print ''\n",
+ "print 'FOR Vout2:'\n",
+ "print 'peak value = %0.2f volts'%V_out_2_max\n",
+ "print 'phase angle = %0.2f degrees'%(V_out_2_phi*180/pi)\n",
+ "print 'with frequency = %0.2f hertz'%f_2\n",
+ "print ''\n",
+ "print 'FOR Vout3:'\n",
+ "print 'peak value = %0.2f volts'%V_out_3_max\n",
+ "print 'phase angle = %0.2f degrees'%(V_out_3_phi*180/pi)\n",
+ "print 'with frequency = %0.2f hertz'%f_3"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example: 6.3 Page No: 477"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 20,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " All the values in the textbook are approximated, hence the values in this code differ from those of Textbook\n",
+ "Output voltage is Vout1+Vout2+Vout3 where\n",
+ "\n",
+ "FOR Vout1:\n",
+ "peak value = 4.98 volts\n",
+ "phase angle = -5.71 degrees\n",
+ "with frequency = 10.00 hertz\n",
+ "\n",
+ "FOR Vout2:\n",
+ "peak value = 3.54 volts\n",
+ "phase angle = -45.00 degrees\n",
+ "with frequency = 100.00 hertz\n",
+ "\n",
+ "FOR Vout3:\n",
+ "peak value = 0.50 volts\n",
+ "phase angle = -84.29 degrees\n",
+ "with frequency = 1000.00 hertz\n"
+ ]
+ }
+ ],
+ "source": [
+ "R=1000/(2*pi)# #resistance\n",
+ "C=10*10**-6# #capacitance\n",
+ "f_B=1/(2*pi*R*C)# #half-power frequency\n",
+ "#the three parts of V_in are V_1=5*cos(20*pi*t)+5*cos(200*pi*t)+5*cos(2000*pi*t)\n",
+ "\n",
+ "#first component V_in_1\n",
+ "V_in_1=5*complex(cos(0),sin(0))# #V_in_1 phasor\n",
+ "w_1=20*pi# #omega\n",
+ "f_1=w_1/(2*pi)# #frequency\n",
+ "H_1=1/(1+1J*(f_1/f_B))# #transfer function\n",
+ "V_out_1=H_1*V_in_1\n",
+ "V_out_1_R=(V_out_1).real# #real part\n",
+ "V_out_1_I=(V_out_1).imag# #imaginary part\n",
+ "V_out_1_max=sqrt((V_out_1_R**2)+(V_out_1_I**2))# #peak value\n",
+ "V_out_1_phi=atan(V_out_1_I/V_out_1_R)# #phase angle\n",
+ "\n",
+ "#second component V_in_2\n",
+ "V_in_2=5*complex(cos(0),sin(0))# #V_in_2 phasor\n",
+ "w_2=200*pi# #omega\n",
+ "f_2=w_2/(2*pi)# #frequency\n",
+ "H_2=1/(1+1J*(f_2/f_B))# #transfer function\n",
+ "V_out_2=H_2*V_in_2\n",
+ "V_out_2_R=(V_out_2).real #real part\n",
+ "V_out_2_I=(V_out_2).imag #imaginary part\n",
+ "V_out_2_max=sqrt((V_out_2_R**2)+(V_out_2_I**2))# #peak value\n",
+ "V_out_2_phi=atan(V_out_2_I/V_out_2_R)# #phase angle\n",
+ "\n",
+ "#third component V_in_3\n",
+ "V_in_3=5*complex(cos(0),sin(0))# #V_in_3 phasor\n",
+ "w_3=2000*pi# #omega\n",
+ "f_3=w_3/(2*pi)# #frequency\n",
+ "H_3=1/(1+1J*(f_3/f_B))# #transfer function\n",
+ "V_out_3=H_3*V_in_3\n",
+ "V_out_3_R=(V_out_3).real #real part\n",
+ "V_out_3_I=(V_out_3).imag #imaginary part\n",
+ "V_out_3_max=sqrt((V_out_3_R**2)+(V_out_3_I**2))# #peak value\n",
+ "V_out_3_phi=atan(V_out_3_I/V_out_3_R)# #phase angle\n",
+ "\n",
+ "print \" All the values in the textbook are approximated, hence the values in this code differ from those of Textbook\"\n",
+ "print 'Output voltage is Vout1+Vout2+Vout3 where'\n",
+ "print ''\n",
+ "print 'FOR Vout1:'\n",
+ "print 'peak value = %0.2f volts'%V_out_1_max\n",
+ "print 'phase angle = %0.2f degrees'%(V_out_1_phi*180/pi)\n",
+ "print 'with frequency = %0.2f hertz'%f_1\n",
+ "print ''\n",
+ "print 'FOR Vout2:'\n",
+ "print 'peak value = %0.2f volts'%V_out_2_max\n",
+ "print 'phase angle = %0.2f degrees'%(V_out_2_phi*180/pi)\n",
+ "print 'with frequency = %0.2f hertz'%f_2\n",
+ "print ''\n",
+ "print 'FOR Vout3:'\n",
+ "print 'peak value = %0.2f volts'%V_out_3_max\n",
+ "print 'phase angle = %0.2f degrees'%(V_out_3_phi*180/pi)\n",
+ "print 'with frequency = %0.2f hertz'%f_3\n",
+ "#we can observe that there is a clear discrimination = %0.2f output signals based on frequencies i.e, lesser the frequency lesser the effect."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example: 6.4 Page No: 478"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 21,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " All the values in the textbook are approximated, hence the values in this code differ from those of Textbook\n",
+ "Break frequency = 1897.37 Hz\n"
+ ]
+ }
+ ],
+ "source": [
+ "H_max=-30# #transfer function magnitude\n",
+ "f=60\n",
+ "m=20# #low-frequency asymptote slope rate = %0.2f db/decade\n",
+ "#f_B must be K higher than f where K is\n",
+ "K=abs(H_max)/m\n",
+ "#(base 10)log(f_B/60)=1.5 ==>\n",
+ "f_B=60*10**1.5\n",
+ "print \" All the values in the textbook are approximated, hence the values in this code differ from those of Textbook\"\n",
+ "print 'Break frequency = %0.2f Hz'%f_B"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example: 6.5 Page No: 479"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 22,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Phasor voltage across Resistance\n",
+ "peak value = 1.00 volts\n",
+ "phase angle = 0.00 degrees\n",
+ "\n",
+ "Phasor voltage across Inductance\n",
+ "peak value = 10.00 volts\n",
+ "phase angle = 90.00 degrees\n",
+ "\n",
+ "Phasor voltage across Capacitance\n",
+ "peak value = 10.00 volts\n",
+ "phase angle = -90.00 degrees\n"
+ ]
+ }
+ ],
+ "source": [
+ "V_s=1*complex(cos(0),sin(0))\n",
+ "L=159.2*10**-3\n",
+ "R=100\n",
+ "C=0.1592*10**-6\n",
+ "f_o=1/(2*pi*sqrt(L*C))# #resonant frequency\n",
+ "Q_s=2*pi*f_o*L/R# #quality factor\n",
+ "B=f_o/Q_s# #Bandwidth\n",
+ "#Approximate half-power frequencies are\n",
+ "f_H=f_o+(B/2)\n",
+ "f_L=f_o-(B/2)\n",
+ "#At resonance\n",
+ "Z_L=1J*2*pi*f_o*L# #impedance of inductance\n",
+ "Z_C=-1J/(2*pi*f_o*C)# #impedance of capacitance\n",
+ "Z_s=R+Z_L+Z_C\n",
+ "I=V_s/Z_s# #phasor current\n",
+ "#voltages across diffrent elements are\n",
+ "#for resistance\n",
+ "V_R=R*I\n",
+ "V_R_R=(V_R).real #real part\n",
+ "V_R_I=(V_R).imag #imaginary part\n",
+ "V_R_max=sqrt((V_R_R**2)+(V_R_I**2))# #peak value\n",
+ "V_R_phi=atan(V_R_I/V_R_R)# #phase angle\n",
+ "#for inductance\n",
+ "V_L=Z_L*I\n",
+ "V_L_R=(V_L).real #real part\n",
+ "V_L_I=(V_L).imag #imaginary part\n",
+ "V_L_max=sqrt((V_L_R**2)+(V_L_I**2))# #peak value\n",
+ "#Z_L is pure imaginary ==> V_L is pure imaginary which means V_L_phi can be +or- pi/2\n",
+ "if ((V_L/1J)==abs(V_L)):\n",
+ " V_L_phi=pi/2\n",
+ "elif ((V_L/1J)==-abs(V_L)):\n",
+ " V_L_phi=-pi/2\n",
+ "\n",
+ "\n",
+ "#for capacitance\n",
+ "V_C=Z_C*I\n",
+ "V_C_R=(V_C).real #real part\n",
+ "V_C_I=(V_C).imag #imaginary part\n",
+ "V_C_max=sqrt((V_C_R**2)+(V_C_I**2))# #peak value\n",
+ "#Z_C is pure imaginary ==> V_C is pure imaginary which means V_C_phi can be +or- pi/2\n",
+ "if ((V_C/1J)==abs(V_C)) :\n",
+ " V_C_phi=pi/2\n",
+ "elif ((V_C/1J)==-abs(V_C)) :\n",
+ " V_C_phi=-pi/2\n",
+ "\n",
+ " \n",
+ "print 'Phasor voltage across Resistance'\n",
+ "print 'peak value = %0.2f volts'%V_R_max\n",
+ "print 'phase angle = %0.2f degrees'%(V_R_phi*180/pi)\n",
+ "print ''\n",
+ "print 'Phasor voltage across Inductance'\n",
+ "print 'peak value = %0.2f volts'%V_L_max\n",
+ "print 'phase angle = %0.2f degrees'%(V_L_phi*180/pi)\n",
+ "print ''\n",
+ "print 'Phasor voltage across Capacitance'\n",
+ "print 'peak value = %0.2f volts'%V_C_max\n",
+ "print 'phase angle = %0.2f degrees'%(V_C_phi*180/pi)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example: 6.6 Page No: 480"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 23,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Current phasor across Resistance\n",
+ "peak value = 0.001 amperes\n",
+ "phase angle = 0 degrees\n",
+ "\n",
+ "Current phasor across Inductance\n",
+ "peak value = 0.010 amperes\n",
+ "phase angle = -90.00 degrees\n",
+ "\n",
+ "current phasor across capacitance\n",
+ "peak value = 0.010 amperes\n",
+ "phase angle = 90.00 degrees\n"
+ ]
+ }
+ ],
+ "source": [
+ "R=10*10**3\n",
+ "f_o=1*10**6\n",
+ "B=100*10**3\n",
+ "I=10**-3*complex(cos(0),sin(0))\n",
+ "Q_p=f_o/B# #quality factor\n",
+ "L=R/(2*pi*f_o*Q_p)\n",
+ "C=Q_p/(2*pi*f_o*R)\n",
+ "#At resonance\n",
+ "V_out=I*R\n",
+ "Z_L=1J*2*pi*f_o*L\n",
+ "Z_C=-1J/(2*pi*f_o*C)\n",
+ "\n",
+ "#across resistance\n",
+ "I_R=V_out/R\n",
+ "I_R_R=(I_R).real# #real part\n",
+ "I_R_I=(I_R).imag# #imaginary part\n",
+ "I_R_max=sqrt((I_R_R**2)+(I_R_I**2))# #peak value\n",
+ "I_R_phi=atan(I_R_I/I_R_R)# #phase angle\n",
+ "\n",
+ "#across inductance\n",
+ "I_L=V_out/Z_L\n",
+ "I_L_R=(I_L).real #real part\n",
+ "I_L_I=(I_L).imag# #imaginary part\n",
+ "I_L_max=sqrt((I_L_R**2)+(I_L_I**2))# #peak value\n",
+ "#Z_L is pure imaginary ==> V_L is pure imaginary which means V_L_phi can be +or- pi/2\n",
+ "if ((I_L/1J)==abs(I_L)):\n",
+ " I_L_phi=pi/2\n",
+ "elif ((I_L/1J)==-abs(I_L)) :\n",
+ " I_L_phi=-pi/2\n",
+ "\n",
+ "\n",
+ "#across capacitor\n",
+ "I_C=V_out/Z_C\n",
+ "I_C_R=(I_C).real# #real part\n",
+ "I_C_I=(I_C).imag# #imaginary part\n",
+ "I_C_max=sqrt((I_C_R**2)+(I_C_I**2))# #peak value\n",
+ "#Z_C is pure imaginary ==> V_C is pure imaginary which means V_C_phi can be +or- pi/2\n",
+ "if ((I_C/1J)==abs(I_C)):\n",
+ " I_C_phi=pi/2\n",
+ "elif ((I_C/1J)==-abs(I_C)) :\n",
+ " I_C_phi=-pi/2\n",
+ "\n",
+ "\n",
+ "print 'Current phasor across Resistance'\n",
+ "print 'peak value = %0.3f amperes'%I_R_max\n",
+ "print 'phase angle = %0.f degrees'%(I_R_phi*180/pi)\n",
+ "print ''\n",
+ "print 'Current phasor across Inductance'\n",
+ "print 'peak value = %0.3f amperes'%I_L_max\n",
+ "print 'phase angle = %0.2f degrees'%(I_L_phi*180/pi)\n",
+ "print ''\n",
+ "print 'current phasor across capacitance'\n",
+ "print 'peak value = %0.3f amperes'%I_C_max\n",
+ "print 'phase angle = %0.2f degrees'%(I_C_phi*180/pi)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example: 6.7 Page No: 481"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 24,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " All the values in the textbook are approximated, hence the values in this code differ from those of Textbook\n",
+ "\n",
+ "The required second order circuit configuration is\n",
+ "Inductance = 50.00 KH\n",
+ "Capacitance = 0.51 mF(micro Farads)\n",
+ "Resistance = 314.16 ohms\n"
+ ]
+ }
+ ],
+ "source": [
+ "#We need a high-pass filter\n",
+ "L=50*10**-3\n",
+ "#for the transfer function to be approximately constant = %0.2f passband area(from graph given = %0.2f the text), we choose\n",
+ "Q_s=1\n",
+ "f_o=1*10**3\n",
+ "C=1/(((2*pi)**2)*f_o**2*L)\n",
+ "R=2*pi*f_o*L/Q_s\n",
+ "print \" All the values in the textbook are approximated, hence the values in this code differ from those of Textbook\"\n",
+ "print ''\n",
+ "print 'The required second order circuit configuration is'\n",
+ "print 'Inductance = %0.2f KH'%(L*10**3)\n",
+ "print 'Capacitance = %0.2f mF(micro Farads)'%(C*10**6)\n",
+ "print 'Resistance = %0.2f ohms'%R\n",
+ "\n"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 2",
+ "language": "python",
+ "name": "python2"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 2
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython2",
+ "version": "2.7.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}