{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 1: DC circuits" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.10: Calculate_current.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Ex 1.10\n", "clc;clear;close;\n", "format('v',6);\n", "I1=2.5;//A\n", "I2=-1.5;//A\n", "//I1+I2+I3=0//from KCL\n", "I3=-I1-I2;//A\n", "disp(I3,'Current I3(A)');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.11: Determine_the_currents.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Ex 1.11\n", "clc;clear;close;\n", "format('v',6);\n", "I1=3;//A\n", "I3=1;//A\n", "I6=1;//A\n", "//I1-I2-I3=0//from KCL at point a\n", "I2=I1-I3;//A\n", "//I2+I4-I6=0//from KCL at point b\n", "I4=I6-I2;//A\n", "//I3-I4-I5=0//from KCL at point c\n", "I5=I3-I4;//A\n", "disp(I2,'Current I2(A)');\n", "disp(I4,'Current I4(A)');\n", "disp(I5,'Current I5(A)');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.12: Determine_I1_and_I2.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Ex 1.12\n", "clc;clear;close;\n", "format('v',6);\n", "R1=30;//ohm\n", "R2=60;//ohm\n", "R3=30;//ohm\n", "I3=1;//A\n", "I1=I3*(R2+R3)/R2;//A\n", "I2=I1-I3;//A\n", "disp(I1,'Current I1(A)');\n", "disp(I2,'Current I2(A)');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.13: Determine_V1_and_V3.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Ex 1.13\n", "clc;clear;close;\n", "format('v',6);\n", "E=12;//V\n", "V2=8;//V\n", "V4=2;//V\n", "V1=E-V2;//V\n", "//-V2+V3+V4=0;//for Loop B\n", "V3=V2-V4;//V\n", "disp(V1,'Voltage V1(V)');\n", "disp(V3,'Voltage V3(V)');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.14: Calculate_VAB.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Ex 1.14\n", "clc;clear;close;\n", "format('v',6);\n", "V=20;//V\n", "R1=25;//ohm\n", "R2=40;//ohm\n", "R3=15;//ohm\n", "R4=10;//ohm\n", "VAC=R3*V/(R1+R3);//V\n", "VBC=R4*V/(R2+R4);//V\n", "//0=VAB+VBC-VAC;///from KVL\n", "VAB=-VBC+VAC;//V\n", "disp(VAB,'Voltage VAB(V)');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.15: Voltage_and_emf.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Ex 1.15\n", "clc;clear;close;\n", "format('v',6);\n", "E1=10;//V\n", "V2=6;//V\n", "V3=8;//V\n", "//E1=V1+V2;//KCL for left loop\n", "V1=E1-V2;//V\n", "//-E2=-V2-V3;//KCL for right loop\n", "E2=V2+V3;//V\n", "disp(V1,'Voltage V1(V)');\n", "disp(E2,'Voltage E2(V)');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.1: Current_in_the_circuit.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Ex 1.1\n", "clc;clear;close;\n", "format('v',4);\n", "R=3;//kohm\n", "V=220;//V\n", "//First Case\n", "I=V/R;//mA\n", "disp(I,'1st case : Current in the circuit(mA)');\n", "//Second Case\n", "Req=R+R;//ohm(Equivalent resistance)\n", "I=V/Req;//mA\n", "disp(I,'2nd case : Current in the circuit(mA)');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.2: Voltage_across_resistor.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Ex 1.2\n", "clc;clear;close;\n", "format('v',5);\n", "I=1.5;//A\n", "R1=2;//ohm\n", "R2=3;//ohm\n", "R3=8;//ohm\n", "V1=I*R1;//V\n", "V2=I*R2;//V\n", "V3=I*R3;//V\n", "disp(V1,'Voltage across R1(V)');\n", "disp(V2,'Voltage across R2(V)');\n", "disp(V3,'Voltage across R3(V)');\n", "V=V1+V2+V3;//V(Supply voltage)\n", "disp(V,'Supply Voltage(V)');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.3: Circuit_current.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Ex 1.3\n", "clc;clear;close;\n", "format('v',6);\n", "Vs=100;//V(Supply voltage)\n", "R1=40;//ohm\n", "R2=50;//ohm\n", "R3=70;//ohm\n", "R=R1+R2+R3;//ohm(Equivalent resistance)\n", "I=Vs/R;//A(Current in the circuit)\n", "disp(I,'Circuit current(A)');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.4: Resistance_R1.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Ex 1.4\n", "clc;clear;close;\n", "format('v',6);\n", "Vo=10;//V(Output voltage)\n", "Vin=30;//V(Input voltage)\n", "R2=100;//ohm\n", "//V2/V=R2/(R1+R2)//Voltage divider rule\n", "R1=(Vin*R2-Vo*R2)/Vo;//ohm\n", "disp(R1,'Resistance of R1(ohm)');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.5: Supply_Current.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Ex 1.5\n", "clc;clear;close;\n", "format('v',6);\n", "V=110;//V\n", "R1=22;//ohm\n", "R2=44;//ohm\n", "I1=V/R1;//A\n", "I2=V/R2;//A\n", "I=I1+I2;//A\n", "disp(I,'Supply current(A)');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.6: Effective_resistance_and_Supply_current.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Ex 1.6\n", "clc;clear;close;\n", "format('v',5);\n", "V=12;//V\n", "R1=6.8;//ohm\n", "R2=4.7;//ohm\n", "R3=2.2;//ohm\n", "R=1/(1/R1+1/R2+1/R3);//ohm(Effective resistance)\n", "I=V/R;//A(Supply current)\n", "disp(R,'Effective resistance(ohm)')\n", "disp(I,'Supply current(A)');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.7: Current_in_the_resistor.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Ex 1.7\n", "clc;clear;close;\n", "format('v',4);\n", "I=8;//A\n", "R2=2;//ohm\n", "// Part (a) \n", "R1=2;//ohm\n", "I2=I*R1/(R1+R2);//A\n", "disp(I2,'(a) Current in 2 ohm resistance(A)');\n", "// Part (b) \n", "R1=4;//ohm\n", "I2=I*R1/(R1+R2);//A\n", "disp(I2,'(b) Current in 2 ohm resistance(A)');" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1.8: Calculate_current.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Ex 1.8\n", "clc;clear;close;\n", "format('v',6);\n", "I1=3;//A\n", "I2=-4;//A\n", "I4=2;//A\n", "//I1-I2+I3-I4=0//from KCL\n", "I3=-I1+I2+I4;//A\n", "disp(I3,'Current I3(A)');" ] } ], "metadata": { "kernelspec": { "display_name": "Scilab", "language": "scilab", "name": "scilab" }, "language_info": { "file_extension": ".sce", "help_links": [ { "text": "MetaKernel Magics", "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" } ], "mimetype": "text/x-octave", "name": "scilab", "version": "0.7.1" } }, "nbformat": 4, "nbformat_minor": 0 }