Chapter8-Transient Analysis

Ex13-pg8.16

In [1]:
##Transient analysis
##pg no - 8.17
##example no - 8.13
import math
import numpy
a=((10.*30.)/(10.+30.));
d=5./a;
b=0.;
c=5.*(20./30.);
print"%s %.2f %s"%("iL(0-) = ",d," A");
print"%s %.2f %s"%("\nvb(0-) = ", b,"");
print"%s %.2f %s"%("\nva(0-) = ",c," V");
print("Applying Kcl equations at t=0+");
print("((va(0+)-5)/10)+(va(0+)/10)+(va(0+)-vb(0+))/20 = 0");        ##equation 1
print("((vb(0+)-va(0+))/20)+((vb(0+)-5)/10)+(2/3) = 0");            ##equation 2
##solving 1 and 2
M=numpy.matrix([[0.25, -0.05],[-0.05, 0.15]]);
N=numpy.matrix([[0.5], [-0.167]]);

X=numpy.dot(numpy.linalg.inv(M),N);
print[X]
print("va(0+)= 1.9 A");
print("vb(0+)= -0.477 A");
iL(0-) =  0.67  A

vb(0-) =  0.00 

va(0-) =  3.33  V
Applying Kcl equations at t=0+
((va(0+)-5)/10)+(va(0+)/10)+(va(0+)-vb(0+))/20 = 0
((vb(0+)-va(0+))/20)+((vb(0+)-5)/10)+(2/3) = 0
[matrix([[ 1.90428571],
        [-0.47857143]])]
va(0+)= 1.9 A
vb(0+)= -0.477 A

Ex14-pg8.17

In [2]:
##Transient analysis
##pg no - 8.17
##example no - 8.13
print("va(0+) = 5V");
print("vb(0+) = 5V");
print("vb(0+) = 5V");
print("Writing KCL Equation at t=0+");
print("0.25*va(0+) = 0.75");
x=(0.75)/(0.25);
print"%s %.2f %s"%("va(0+) = ",x," V");
va(0+) = 5V
vb(0+) = 5V
vb(0+) = 5V
Writing KCL Equation at t=0+
0.25*va(0+) = 0.75
va(0+) =  3.00  V