#Question:
"""Finding the current I in the circuit using superposition theorem."""
#Calculations:
I1=-0.5*(0.3/(0.1+0.3))
I2=80e-03/(0.1+0.3)
I=I1+I2
#Result:
print "The current I in the circuit is %.3f A." %(I)
#Question:
"""Finding current I_x in the network using superposition theorem."""
#Calculations:
I1=10.0/(50+150)
I2=40*(150.0/(50+150))
I3=-120*(50.0/(150+50))
Ix=I1+I2+I3
#Result:
print "The current Ix determined using superposition principle is %.2f A." %(Ix)
#Question:
"""Finding the voltage across resistor by applying the principle of superposition."""
#Calculations:
i=4.0*(1.0/(1.0+(2+3)))
R=3.0
v_4=i*R
v_5=(-5*(1.0/(1+(2+3))))*R
v_6=6.0*(3.0/(1+2+3))
v=+v_4+v_5+v_6
#Result:
print "The total voltage(v) across the 3 ohm resistor is %.2f V." %(v)
#Question:
"""Finding the value of I_s to reduce the voltage across the 4-ohm resistor to zero. """
#Variable Declaration:
V_source=10.0 #Voltage of the source(in Volts)
#Calculations:
I1=V_source/(2+4+6)
""" I2(from top to bottom in the 4 ohm resistor) = -Is*((2+6)/(2+6+4)) = -(2/3)*Is ;
The voltage across the 4 ohm resistor can be zero,only if the current through this resistor is zero.
I1+I2=0; """
Is=I1*(3.0/2)
#Result:
print "The current Is to reduce the voltage across the 4 ohm resistor to zero is %.2f A." %(Is)
#Question:
"""Finding the voltage across the load resistor using Thevenin's theorem."""
#Calculations:
I1=(50.0-10.0)/(10+10+20)
I2=1.5*(10.0/(10.0+(10+20)))
I=I1+I2
V_Th=I*20
R_Th=1.0/((1.0/20)+(1.0/(10+10)))
R_L=5.0
V_L=V_Th*(R_L/(R_L+R_Th))
#Result:
print "The voltage across the load resistor R_L is %.2f V." %(V_L)
#Question:
"""Finding the voltage across the resistor by applying Thevenin's theorem."""
#Calculations:
V_Th=5.0*1.0
R_Th=3.0
R_L=3.0
V_L=V_Th*(R_L/(R_L+R_Th))
#Result:
print "The voltage across the resistor by applying Thevenin's Theorem is %.2f V." %(V_L)
#Question:
"""Finding Norton's equivalent circuit with respect to terminals AB."""
#Calculations:
I1=10.0/5
I2=5.0/10
I_N=I1+I2
R_N=1.0/((1.0/5)+(1.0/10))
I_L=I_N*((10.0/3)/((10.0/3)+5))
#Result:
print "When terminals AB are shorted, the current I_N is %.2f A." %(I_N)
print "The value of current that would flow through a load resistor of 5 ohm if it were connected across terminals AB is %.2f A." %(I_L)
#Question:
"""Finding the available power from the battery."""
#Variable Declaration:
Voc=12.6 #Open-circuit voltage(in Volts)
Isc=300.0 #Short-circuit voltage(in Volts)
#Calculations:
Ro=Voc/Isc
P_avl=(Voc*Voc)/(4*Ro)
#Result:
print "The available power from the battery is %.2f W." %(P_avl)
#Question:
"""Finding the available power from the battery."""
#Variable Declaration:
no_of_cells=8 #Number of dry cells in the battery
emf=1.5 #EMF of each cell(in Volts)
int_res=0.75 #Internal resistanceof each cell(in Ohms)
#Calculations:
Voc=no_of_cells*emf
Ro=no_of_cells*int_res
P_avl=(Voc*Voc)/(4.0*Ro)
#Result:
print "The available power from the battery is %.2f W." %(P_avl)
#Question:
"""Plotting a curve showing the variation of the output power Po with the load resistance R_L."""
from math import sqrt
#Variable Declaration:
P=25.0 #Power to be delivered to the speaker(in Watts)
Ro=8.0 #Resistance of the speaker(in Ohms)
#Calculations:
V_Th=sqrt(P*4*Ro)
Vo=V_Th/2.0
R_Th=Ro
R_L=0.0
P1=(V_Th*V_Th*R_L)/((R_Th+R_L)*(R_Th+R_L))
R_L=2.0
P2=(V_Th*V_Th*R_L)/((R_Th+R_L)*(R_Th+R_L))
R_L=4.0
P3=(V_Th*V_Th*R_L)/((R_Th+R_L)*(R_Th+R_L))
R_L=6.0
P4=(V_Th*V_Th*R_L)/((R_Th+R_L)*(R_Th+R_L))
R_L=8.0
P5=(V_Th*V_Th*R_L)/((R_Th+R_L)*(R_Th+R_L))
R_L=16.0
P6=(V_Th*V_Th*R_L)/((R_Th+R_L)*(R_Th+R_L))
R_L=32.0
P7=(V_Th*V_Th*R_L)/((R_Th+R_L)*(R_Th+R_L))
P8=0.0
#Result:
print "(a)The voltage provided by this amplifier to to the speaker is %.2f V." %(Vo)
print "(b)(i)If the load is a short circuit(R_L=0),the output voltage Vo would be zero and hence the output power,Po= Vo*I_L = 0*I_L =0."
print " (ii) If the load is an open circuit(R_L=0),the load current I_L would be zero and hence the output power,Po= Vo*I_L = Vo*0 = 0."
print "(c)(i) For R_L = 0 , Po = %.2f W. \n (ii) For R_L = 2 Ohms, Po = %.2f W." %(P1,P2)
print " (iii) For R_L = 4 Ohms, Po = %.2f W. \n (iv) For R_L = 6 Ohms, Po = %.2f W." %(P3,P4)
print " (v) For R_L = 8 Ohms, Po = %.2f W. \n (vi) For R_L = 16 Ohms, Po = %.2f W." %(P5,P6)
print " (vii) For R_L = 32 Ohms, Po = %.2f W. \n (viii) For R_L = infinity, Po = %.2f W." %(P7,P8)
print "Note: Po is the power delivered to the speaker (in Watts) and R_L is the speaker resistance(in Ohms)."
from __future__ import division
from pylab import *
from matplotlib import *
import numpy as np
%matplotlib inline
#Variable declaration:
Rdata=[0.0, 2.0, 4.0, 6.0, 8.0, 16.0] #(in ohm)
Podata=[0, 16, 22.22, 24.49, 25, 22.22] #(in Watt)
#Calculations:
R=np.array(Rdata)
Po=np.array(Podata)
length=len(R)
Rmax=R[length-1]
a=polyfit(R,Po,4)
Rfit=[0]*100
Pofit=[0]*100
for n in range(1,100,1):
Rfit[n-1]=Rmax*(n-1)/100
Pofit[n-1]=a[0]*Rfit[n-1]**4+a[1]*Rfit[n-1]**3+a[2]*Rfit[n-1]**2+a[3]*Rfit[n-1]+a[4]
#Plot the data and then the fit to compare (convert xfit to cm and Lfit to mH)
plot(Rdata,Podata,'o')
plot(np.array(Rfit),np.array(Pofit),'g.')
xlabel('R_L (in ohm) ')
ylabel('Po (in Watt) ')
title('Ouput power(Po) vs. Speaker Resistance(R_L)')
grid()
print "\n\nThe required plot is shown below: "
show()
#Question:
"""Finding the current in branch B due to the voltage source of 36 V in branch A."""
#Variable Declaration:
V_supply_a=36.0 #Supply voltage in the network shown in figure a(in Volts)
Req_a=2+ 1/((1.0/12)+(1.0/(3+1))) + 4 #Equivalent resistance of network shown in figure a(in Ohms)
#Calculations:
I_supply_a=V_supply_a/Req_a
I=I_supply_a*(12.0/(12+4))
V_supply_b=36.0
Req_b= 3+ 1.0/((1.0/12)+(1.0/(2+4))) + 1
I_supply_b=V_supply_b/Req_b
I_dash= I_supply_b*(12.0/(12+6))
R_tr=V_supply_a/I
#Result:
print "The current I(in figure (a)) is %.2f A and the current I'(in branch A in figure (b)) is %.2f A." %(I,I_dash)
if(I==I_dash) : print "As the two currents I and I' have the same value, the reciprocity theorem is established.\n "
else : print "As the two currents I and I' have different values, the reciprocity theorem is not established.\n "
print "The transfer resistance is %.2f Ohms." %(R_tr)
#Question:
"""Finding the current using Thevenin's theorem."""
#Variable Declaration:
R_L=20.0 #Load resistance(in Ohms)
#Calculations:
""" KVL equation for the loop bacdeb, V_Th+50-20+10=0."""
V_Th=-50.0-10.0+20.0
"""Shorting all the voltage sources."""
R_Th=0.0
I3=V_Th/(R_L+R_Th)
#Result:
print "The current I3 in the circuit is %.2f A." %(I3)
#Question:
"""Finding the current using Thevenin's theorem."""
#Variable Declaration:
R_L=1.0 #Load resistance(in Ohms)
#Calculations:
""" KVL equation for the loop bacdeb, V_Th+50-20+10=0."""
V_Th=20.0-10.0-9.0
"""Shorting all the voltage sources."""
R_Th=0.0
I2=V_Th/(R_L+R_Th)
#Result:
print "The current I2 in the circuit is %.2f A." %(I2)
#Question:
"""Finding the current using superposition theorem."""
#Variable Declaration:
R=0.5 #Load resistance(in Ohms)
#Calculations:
I=15.0/(1+0.6)
I1=I*(1/(1+(R+1)))
I2=20/((2/3.0)+2)
I1_20=I2*(2.0/(2.0+(R+R)))
Inet=I1-I1_20
#Result:
print "The current flowing through R from A to B is %.2f A." %(Inet)
#Question:
"""Finding the voltage across the resistance using Thevenin's theorem."""
#Calculations:
"""The first step is to remove the 5 Ohms resistance.Then, find the open-circuit voltage Voc across AB.
Using nodal analysis,for node C we can write ((Voc-20)/2)+((Voc+10)/1)+((Voc-12)/4)=10."""
Voc=(10+3)/(0.5+1+0.25)
V_Th=Voc
R_Th=1.0/((1.0/2.0)+(1.0)+(1/4.0))
V_AB=V_Th*(5.0/(5.0+R_Th))
#Result:
print "The voltage across the 5 Ohms resistance is %.2f V." %(V_AB)
print "Note:There is a calculation error in the textbook.Voc=7.43 V but not 1.74 V. Therefore V_AB=6.67 V."
#Question:
"""Finding the current using Norton's theorem."""
#Calculations:
Isc=20.0/10.0
I_N=Isc
R_N=1.0/((1.0/10)+(1.0/10))
I=I_N*(R_N/(R_N+2.0))
#Result:
print "The current through the 2 Ohms resistance when connected across terminals AB is %.2f A." %(I)
#Question:
"""Finfing the power consumed by resistor using Norton's theorem."""
#Variable Declaration:
R_L=2.0 #Resistance of load(in Ohms)
#Calculations:
"""To determine I_N,short circuit the terminals xy and find the current Isc throgh this short circuit.
Applying node-voltage analysis to determine the voltage at node 1,
((V1-12)/3)+(V1/2)=4;"""
V1=(4.0+(12.0/3.0))/((1.0/3.0)+0.5)
Isc=V1/2.0
I_N=Isc
R_N=1.0/((1.0/(3.0+2.0))+(1.0/5.0))
I=I_N*(R_N/(R_N+R_L))
P=I*I*R_L
#Result:
print "The power consumed by the 2 Ohms load reistor is %.3f W." %(P)
#Question:
"""Finding the voltage across load."""
#Variable Declaration:
R_L=5.0 #Load resistance(in Ohms)
#Calculations:
R_N=1.0/((1.0/20.0)+(1.0/(10.0+10.0)))
I_N=(65.0-10.0)/(10.0+10.0)
I_L=I_N*(R_N/(R_N+R_L))
V_L=I_L*R_L
#Result:
print "The voltage across the load using Norton's theorem is %.2f V." %(V_L)
#Question:
"""Finding the reading of voltmeter."""
#Variable Declaration:
R=500e03 #Resistance across which voltmeter is connected(in Ohms)
Rm=10e06 #Internal resistance of voltmeter(in Ohms)
#Calculations:
V_a=10.0*(R/(R+800e03))
R_Th=1.0/((1/R)+(1/800e03))
V_Th=V_a
V_b=V_Th*(Rm/(Rm+R_Th))
#Result:
print "(a)The reading of the voltmeter if it assumed to be ideal is %.2f V." %(V_a)
print "(b)The reading of the voltmeter if it has an internal resistance of 10 M Ohms is %.2f V." %(V_b)
#Question:
"""Finding the load resistance for receiving maximum power."""
#Variable Declaration:
R_L=3e03 #Load resistance(in Ohms)
#Calculations:
"""First, we remove R_L and then find Voc=V_Th. We transform the 5-mA current source into voltage source."""
Voc=(60.0-40.0)*((6e03)/((6e03)+(12e03+18e03)))
V_Th=Voc
R_Th=1.0/((1.0/6e03)+(1.0/(12e03+18e03)))
Vab_b=V_Th*(R_L/(R_L+R_Th))
R_L_c=R_Th
""" The current required through 6 kilo Ohms resistor is 0.1 mA."""
Vab_d=(0.1e-03)*(6e03)
V_30k=20-Vab_d
I_30k=V_30k/(30e03)
I_L=I_30k-(0.1e-03)
R_L_d=Vab_d/I_L
#Result:
print "(a)The Thevenin's equivalent voltage is %.2f V and the Thevenin's resistance is %.2f kilo Ohms." %(V_Th,(R_Th/1000.0))
print "(b)The Vab for R_L=3 kilo Ohms is %.3f V." %(Vab_b)
print "(c)The value of R_L which receives maximum power from the circuit is %.2f kilo Ohms." %(R_L_c/1000.0)
print "(d)The value of R_L which makes the current in the 6 kilo Ohms resistor to be 0.1 mA is %.3f kilo Ohms." %(R_L_d/1000.0)
#Question:
"""Finding the value of resistance."""
#Variable Declaration:
V=12.0 #Supply voltage(in Volts)
#Calculations:
""" To receive maximum power,the resistance R should be equal to the output resistance of the remaining circuit,which is same as
Thevenin's resistance."""
R_Th=1.0/((1.0/2.0)+(1.0/6.0))
R=R_Th
""" Mesh equations to find loop currents I1 and I2,
(8*I1)-(6*I2)=4 and -(6*I1)+(7.5*I2)=8. Solving these equations, we get I1=3.25 A. """
I1=((4*7.5)+(8*6))/((8*7.5)-(6*6))
P=V*I1
#Result:
print "(a)The value of R to receive maximum power from the circuit is %.2f Ohms." %(R)
print "(b)The power supplied by the 12 V source is %.2f W." %(P)
#Question:
"""Finding the current Is."""
#Calculations:
I1=12.0/(80.0+120)
""" I2=Is*(80/(80+120)); I1+I2=0;"""
Is=-I1/(80.0/(80+120))
#Result:
print "The current Is such that the current through 120 Ohms resistor is zero is %.2f A." %(Is)
#Question:
"""Finding the Thevenin equivalent circuit."""
#Variable Declaration:
Vs=12.0 #Supply voltage(in Volts)
#Calculations:
"""The circuit has no independent source.So,the current I in the 12 Ohms resistor will be zero and hence the dependent voltage source
(8*I) will also be zero. Obviously,Thevenin's voltage V_Th=0 V. """
V_Th=0.0
I=12.0/12.0
V=8*I
"""Applying KCL to node a,"""
Is=(12.0/12.0)+(12.0/6.0)+((12.0-8.0)/4.0)
R_Th=Vs/Is
#Result:
print "The Thevenin's equivalent resistance is %.2f Ohms and the Thevenin's equivalent voltage is %.2f V." %(R_Th,V_Th)