summaryrefslogtreecommitdiff
path: root/Engineering_Circuit_Analysis_by_W_Hayt/2-Basic_components_and_Electric_Circuits.ipynb
blob: a8cbdbdc1d592d64f6b79b9775bea4d4f01c5680 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
{
"cells": [
 {
		   "cell_type": "markdown",
	   "metadata": {},
	   "source": [
       "# Chapter 2: Basic components and Electric Circuits"
	   ]
	},
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 2.1: Power.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"//Example 2.1\n",
"//Computation of power absorbed by each part\n",
"//From figure 2.13a\n",
"V=2;I=3;\n",
"//We have Power(P)=V*I\n",
"P=V*I\n",
"printf('a) Power =%dW\n',P)\n",
"if P>0 then\n",
"    printf('Power is absorbed by the element\n')\n",
"else\n",
"    printf('Power is supplied by the element\n');\n",
"end \n",
"\n",
"clear P;\n",
"//From figure 2.13b\n",
"V=-2;I=-3;\n",
"//We have Power(P)=V*I\n",
"P=V*I\n",
"printf('b) Power =%dW\n',P)\n",
"if P>0 then\n",
"    printf('Power is absorbed by the element\n')\n",
"else\n",
"    printf('Power is supplied by the element\n')\n",
"end\n",
"\n",
"//From figure 2.13c\n",
"V=4;I=-5;\n",
"//We have Power(P)=V*I\n",
"P=V*I\n",
"printf('c) Power =%dW\n',P)\n",
"if P>0 then\n",
"    printf('Power is absorbed by the element\n')\n",
"else\n",
"    printf('Power is supplied by the element\n')\n",
"end "
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 2.2: Dependent_sources.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"//Example 2.2\n",
"//Calculate vL \n",
"disp('Given')\n",
"disp('v2=3V')\n",
"v2=3;\n",
"//From figure 2.19b\n",
"disp('Considering the right hand part of the circuit ')\n",
"disp('vL=5v2')\n",
"vL=5*v2;\n",
"disp('On substitution')\n",
"printf('vL=%dV\n',vL);\n",
""
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 2.3: Ohm_law.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"//Example 2.3\n",
"//Calculate the voltage and power dissipated acreoss the resistor terminals\n",
"//From figure 2.24b\n",
"disp('Given')\n",
"disp('R=560 ohm ; i=428mA')\n",
"R=560;i=428*10^-3;\n",
"//Voltage across a resistor is\n",
"disp('v=R*i')\n",
"v=R*i;\n",
"printf('Voltage across a resistor=%3.3fV\n',v)\n",
"\n",
"//Power dissipated by the resistor is\n",
"disp('p=v*i')\n",
"p=v*i;\n",
"printf('Power dissipated by the resistor=%3.3fW\n',p)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 2.4: Ohm_law.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"//Example 2.4\n",
"//Calculate the power dissipated within the wire\n",
"//From figure 2.27\n",
"disp('Given')\n",
"disp('Total length of the wire is 4000 feet')\n",
"disp('Current drawn by lamp is 100A')\n",
"//Considering American Wire Gauge system(AWG)\n",
"//Referring Table 2.4\n",
"disp('4AWG=0.2485ohms/1000ft')\n",
"l=4000; i=100 ; rl=0.2485/1000;\n",
"//Let R be the wire resistance\n",
"R=l*rl;\n",
"//Let p be the power dissipated within the wire\n",
"disp('p=i^2*R')\n",
"p=i^2*R\n",
"printf('Power dissipated within the wire=%dW\n',p)"
   ]
   }
],
"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
}