{ "metadata": { "name": "", "signature": "sha256:443594b95e4699aa829647ef6201862e165405ad0d20cad94e2fc280e9a33ca5" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter8-Transient Analysis" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex13-pg8.16" ] }, { "cell_type": "code", "collapsed": false, "input": [ "##Transient analysis\n", "##pg no - 8.17\n", "##example no - 8.13\n", "import math\n", "import numpy\n", "a=((10.*30.)/(10.+30.));\n", "d=5./a;\n", "b=0.;\n", "c=5.*(20./30.);\n", "print\"%s %.2f %s\"%(\"iL(0-) = \",d,\" A\");\n", "print\"%s %.2f %s\"%(\"\\nvb(0-) = \", b,\"\");\n", "print\"%s %.2f %s\"%(\"\\nva(0-) = \",c,\" V\");\n", "print(\"Applying Kcl equations at t=0+\");\n", "print(\"((va(0+)-5)/10)+(va(0+)/10)+(va(0+)-vb(0+))/20 = 0\"); ##equation 1\n", "print(\"((vb(0+)-va(0+))/20)+((vb(0+)-5)/10)+(2/3) = 0\"); ##equation 2\n", "##solving 1 and 2\n", "M=numpy.matrix([[0.25, -0.05],[-0.05, 0.15]]);\n", "N=numpy.matrix([[0.5], [-0.167]]);\n", "\n", "X=numpy.dot(numpy.linalg.inv(M),N);\n", "print[X]\n", "print(\"va(0+)= 1.9 A\");\n", "print(\"vb(0+)= -0.477 A\");\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "iL(0-) = 0.67 A\n", "\n", "vb(0-) = 0.00 \n", "\n", "va(0-) = 3.33 V\n", "Applying Kcl equations at t=0+\n", "((va(0+)-5)/10)+(va(0+)/10)+(va(0+)-vb(0+))/20 = 0\n", "((vb(0+)-va(0+))/20)+((vb(0+)-5)/10)+(2/3) = 0\n", "[matrix([[ 1.90428571],\n", " [-0.47857143]])]\n", "va(0+)= 1.9 A\n", "vb(0+)= -0.477 A\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex14-pg8.17" ] }, { "cell_type": "code", "collapsed": false, "input": [ "##Transient analysis\n", "##pg no - 8.17\n", "##example no - 8.13\n", "print(\"va(0+) = 5V\");\n", "print(\"vb(0+) = 5V\");\n", "print(\"vb(0+) = 5V\");\n", "print(\"Writing KCL Equation at t=0+\");\n", "print(\"0.25*va(0+) = 0.75\");\n", "x=(0.75)/(0.25);\n", "print\"%s %.2f %s\"%(\"va(0+) = \",x,\" V\");" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "va(0+) = 5V\n", "vb(0+) = 5V\n", "vb(0+) = 5V\n", "Writing KCL Equation at t=0+\n", "0.25*va(0+) = 0.75\n", "va(0+) = 3.00 V\n" ] } ], "prompt_number": 2 } ], "metadata": {} } ] }