summaryrefslogtreecommitdiff
path: root/887/CH2
diff options
context:
space:
mode:
Diffstat (limited to '887/CH2')
-rwxr-xr-x887/CH2/EX2.1/2_1.sce11
-rwxr-xr-x887/CH2/EX2.11/2_11.sce13
-rwxr-xr-x887/CH2/EX2.12/2_12.sce7
-rwxr-xr-x887/CH2/EX2.13/2_13.sce8
-rwxr-xr-x887/CH2/EX2.14/2_14.sce9
-rwxr-xr-x887/CH2/EX2.15/2_15.sce12
-rwxr-xr-x887/CH2/EX2.16/2_16.sce15
-rwxr-xr-x887/CH2/EX2.17/2_17.sce18
-rwxr-xr-x887/CH2/EX2.18/2_18.sce18
-rwxr-xr-x887/CH2/EX2.19/2_19.sce13
-rwxr-xr-x887/CH2/EX2.2/2_2.sce37
-rwxr-xr-x887/CH2/EX2.20/2_20.sce24
-rwxr-xr-x887/CH2/EX2.21/2_21.sce15
-rwxr-xr-x887/CH2/EX2.22/2_22.sce14
-rwxr-xr-x887/CH2/EX2.23/2_23.sce23
-rwxr-xr-x887/CH2/EX2.3/2_3.sce11
-rwxr-xr-x887/CH2/EX2.4/2_4.sce14
-rwxr-xr-x887/CH2/EX2.5/2_5.sce17
-rwxr-xr-x887/CH2/EX2.6/2_6.sce9
-rwxr-xr-x887/CH2/EX2.7/2_7.sce12
-rwxr-xr-x887/CH2/EX2.8/2_8.sce12
-rwxr-xr-x887/CH2/EX2.9/2_9.sce9
22 files changed, 321 insertions, 0 deletions
diff --git a/887/CH2/EX2.1/2_1.sce b/887/CH2/EX2.1/2_1.sce
new file mode 100755
index 000000000..acbea52d1
--- /dev/null
+++ b/887/CH2/EX2.1/2_1.sce
@@ -0,0 +1,11 @@
+clc
+//ex2.1
+R_1=10;
+R_2=20;
+R_3=5;
+R_4=15;
+//We proceed through various combinations of resistances in series or parallel while we replace them with equivalent resistances We start with R_3 and R_4.
+R_eq_1=R_3+R_4; //R_3 and R_4 in series
+R_eq_2=1/((1/R_eq_1)+(1/R_2)); //R_eq_1 and R_2 in parallel
+R_eq=R_1+R_eq_2; //R_1 and R_eq_2 in series
+disp(R_eq,'Equivalent resistance in ohms')
diff --git a/887/CH2/EX2.11/2_11.sce b/887/CH2/EX2.11/2_11.sce
new file mode 100755
index 000000000..c77c57f4c
--- /dev/null
+++ b/887/CH2/EX2.11/2_11.sce
@@ -0,0 +1,13 @@
+clc
+//ex2.11
+disp('KCL for a supernode enclosing the conrolled voltage source')
+disp('(V1/R2)+((V1-V3)/R1)+((V2-V3)/R3)=is')
+disp('KCL at node 3')
+disp('(V3/R4)+((V3-V2)/R3)+((V3-V1)/R1)=0')
+disp('KCL at the reference node')
+disp('(V1/R2)+(V3/R4)=is')
+disp('From the closed loop with V1,Vx and V3')
+disp('Vx=V3-V1')
+disp('Applying KVL')
+disp('V1=0.5(V3-V1)+V2')
+disp('The last KVL equation along with any two of the first three KCL equations forms an independent set that can be solved for the node voltages.')
diff --git a/887/CH2/EX2.12/2_12.sce b/887/CH2/EX2.12/2_12.sce
new file mode 100755
index 000000000..e56d7a81d
--- /dev/null
+++ b/887/CH2/EX2.12/2_12.sce
@@ -0,0 +1,7 @@
+clc
+//ex2.12
+//In all the below equations, mesh currents are taken to be flown in clockwise direction
+disp('The required equations to solve for mesh currents are:')
+disp('R2(i1-i3)+R3(i1-i2)-VA=0') //KVL for mesh1
+disp('R3(i2-i1)+R4(i2)+VB=0') //KVL for mesh 2
+disp('R2(i3-i1)+R1(i3)-VB=0') //KVL for mesh 3
diff --git a/887/CH2/EX2.13/2_13.sce b/887/CH2/EX2.13/2_13.sce
new file mode 100755
index 000000000..c5a6e6f51
--- /dev/null
+++ b/887/CH2/EX2.13/2_13.sce
@@ -0,0 +1,8 @@
+clc
+//ex2.13
+R=[30 -10 -20;-10 22 -12;-20 -12 46]; //coefficient matrix
+V=[70;-42;0] //voltage matrix
+I=R\V; //current matrix(from R*I=V)
+disp(I(1),'current in mesh1 in amperes, i1=')
+disp(I(2),'current in mesh2 in amperes, i2=')
+disp(I(3),'current in mesh3 in amperes, i3=')
diff --git a/887/CH2/EX2.14/2_14.sce b/887/CH2/EX2.14/2_14.sce
new file mode 100755
index 000000000..3b569b06f
--- /dev/null
+++ b/887/CH2/EX2.14/2_14.sce
@@ -0,0 +1,9 @@
+clc
+//ex2.14
+//taking mesh currents i1, i2 and i3 in clockwise direction
+disp('The matrix form is')
+disp('RI=V')
+disp('where the matrices are defined as')
+disp('R=[R2+R4+R5,-R2,-R5;-R2,R1+R2+R3,-R3;-R5,-R3,R3+R5+R6]')
+disp('I=[i1;i2;i3]')
+disp('V=[-VA+VB;VA;-VB]')
diff --git a/887/CH2/EX2.15/2_15.sce b/887/CH2/EX2.15/2_15.sce
new file mode 100755
index 000000000..8a1503f8d
--- /dev/null
+++ b/887/CH2/EX2.15/2_15.sce
@@ -0,0 +1,12 @@
+clc
+//ex2.15
+//KVL over the supermesh, we get eqn-1 -20+4(i1)+8(i2)=0
+//Vx=2(i2) ohm's law
+//writing an expression for the source current in terms of mesh currents and substituting Vx from above, we get eqn-2 (1/2)i2=i2-i1
+//Putting eqn-1 and eqn-2 in standard form 4(i1)+8(i2)=20 and i1-(1/2)i2=0
+//solving for currents in matrix method(Ax=b)
+A=[4,8;1,-1/2]; //coeffcient matrix
+b=[20;0]; //constant matrix
+x=A\b; //solution
+disp(x(1),'Value of i1 in amperes')
+disp(x(2),'Value of i2 in amperes')
diff --git a/887/CH2/EX2.16/2_16.sce b/887/CH2/EX2.16/2_16.sce
new file mode 100755
index 000000000..b3e778b19
--- /dev/null
+++ b/887/CH2/EX2.16/2_16.sce
@@ -0,0 +1,15 @@
+clc
+//ex2.16
+V_s=15; //source voltage
+R_1=100;
+R_2=50;
+//Analysis with an open circuit to find V_t
+i_1=V_s/(R_1+R_2); //closed circuit with R_1 and R_2 in series
+V_oc=R_2*i_1; //open-circuit voltage across R_2
+V_t=V_oc; //thevenin voltage
+//Analysis with a short-circuit to find i_sc
+i_sc=V_s/R_1; //R_2 is short-circuited
+R_t=V_oc/i_sc; //thevenin resistance
+printf(" All the values in the textbook are approximated, hence the values in this code differ from those of textbook")
+disp(V_t,'Thevenin voltage for given circuit in volts')
+disp(R_t,'Thevenin voltage for given circuit in ohms')
diff --git a/887/CH2/EX2.17/2_17.sce b/887/CH2/EX2.17/2_17.sce
new file mode 100755
index 000000000..4d021130d
--- /dev/null
+++ b/887/CH2/EX2.17/2_17.sce
@@ -0,0 +1,18 @@
+clc
+//ex2.17
+V_s=20; //source voltage
+i_s=2; //source current
+R_1=5;
+R_2=20;
+//after zeroing the sources which includes replacing voltage source with short circuit and current source with open circuit, we get R_t
+R_eq=1/((1/R_1)+(1/R_2)); //R_1 and R_2 are in parallel combination
+R_t=R_eq; //Thevenin resistance
+//short-circuit analysis to find i_sc
+i_2=0; //voltage across R_2 is 0
+i_1=V_s/R_1;
+i_sc=i_1+2-i_2; //short-circuit current(KCL at junction of R_2 and I_s)
+V_t=R_t*i_sc; //thevenin voltage
+disp(i_sc,'short-circuit current in amperes')
+disp(R_t,'thevenin resistance in ohms')
+disp(V_t,'thevenin voltage in volts')
+//thevenin equivalent can be made of V_t and R_t.
diff --git a/887/CH2/EX2.18/2_18.sce b/887/CH2/EX2.18/2_18.sce
new file mode 100755
index 000000000..36e6d18cb
--- /dev/null
+++ b/887/CH2/EX2.18/2_18.sce
@@ -0,0 +1,18 @@
+clc
+//ex2.18
+V=10;
+R_1=5;
+R_2=10;
+//Open-circuit anlaysis
+//let V_oc be the open circuit voltage
+//Current equation at node1 3(i_x)=(1/10)V_oc
+//i_x=(10-V_oc)/5 ix in terms of V_oc
+V_oc=2/((1/5)+(1/30)); //open-circuit voltage(from above two equations)
+V_t=V_oc; //thevenin voltage
+//short-circuit analysis
+i_x=V/R_1;
+i_sc=3*i_x; //short-circuit current
+R_t=V_oc/i_sc;
+printf(" All the values in the textbook are approximated, hence the values in this code differ from those of textbook")
+disp(V_t,'Thevenin voltage in volts')
+disp(R_t,'Thevenin resistance in ohms')
diff --git a/887/CH2/EX2.19/2_19.sce b/887/CH2/EX2.19/2_19.sce
new file mode 100755
index 000000000..40db4d6c0
--- /dev/null
+++ b/887/CH2/EX2.19/2_19.sce
@@ -0,0 +1,13 @@
+clc
+//ex2.19
+R1= 20 //Ohms
+R2= 15 //ohms
+vs= 15 //V
+R3= 5 //Ohms
+k= 0.25
+///CALCULATIONS
+voc= (R2/R1)/((1/R1)+(1/(R2+R3))+(k/4))
+isc= vs/R1
+Rf= voc/isc
+//RESULTS
+printf ('Rf = %.2f ohms',Rf)
diff --git a/887/CH2/EX2.2/2_2.sce b/887/CH2/EX2.2/2_2.sce
new file mode 100755
index 000000000..aef24ad23
--- /dev/null
+++ b/887/CH2/EX2.2/2_2.sce
@@ -0,0 +1,37 @@
+clc
+//ex2.2
+V_s=90; //source voltage
+R_1=10;
+R_2=30;
+R_3=60;
+R_eq_1=1/((1/R_2)+(1/R_3)); //R_2 and R_3 in parallel
+R_eq=R_1+R_eq_1; //R_1 and R_eq_1 in series
+i_1=V_s/R_eq; //ohm's law
+//i_1 flows clockwise through V_s,R_1 and R_eq_1
+V_2=R_eq_1*i_1; //voltage across R_eq_1
+//As R_eq_1 is equivalent of parallel combination of R_2 and R_3, V_2 appears across both of them
+i_2=V_2/R_2; //ohm's law
+i_3=V_2/R_3; //ohm's law
+//we can verify KCL, i_1=i_2+i_3
+V_1=i_1*R_1; //ohm's law
+//we can verify KVL, V_s=V_1+V_2
+P_s=-V_s*i_1; //source power(-ve sign as V_s and i_1 have references opposite to passive configuration)
+P_1=i_1^2*R_1; //power for R_1
+P_2=V_2^2/R_2; //power for R_2
+P_3=V_2^2/R_3; //power for R_3
+disp('FOR SOURCE')
+disp(i_1,'current in amperes')
+disp(P_s,'power in watts')
+disp('FOR R1')
+disp(i_1,'current in amperes')
+disp(V_1,'voltage in volts')
+disp(P_1,'power in watts')
+disp('FOR R2')
+disp(i_2,'current in amperes')
+disp(V_2,'voltage in volts')
+disp(P_2,'power in watts')
+disp('FOR R3')
+disp(i_3,'current in amperes')
+disp(V_2,'voltage in volts')
+disp(P_3,'power in watts')
+//we may verify that P_s+P_1+P_2+P_3=0
diff --git a/887/CH2/EX2.20/2_20.sce b/887/CH2/EX2.20/2_20.sce
new file mode 100755
index 000000000..48b494a70
--- /dev/null
+++ b/887/CH2/EX2.20/2_20.sce
@@ -0,0 +1,24 @@
+clc
+//ex2.20
+V_s_1=20; //voltage source
+R_1=5;
+R_2=10;
+i_s_1=1; //current source
+//Method 1: To transform current source and R_2 into a voltage source in series with R_2
+V_s_2=i_s_1*R_2; //source transformation
+i_1=(V_s_1-V_s_2)/(R_1+R_2); //clockwise KVL
+i_2=i_1+i_s_1; //KCL at top node of original circuit
+printf(" All the values in the textbook are approximated hence the values in this code differ from those of Textbook")
+disp('By current source to voltage source transformation:')
+disp(i_1,'current i1 in amperes')
+disp(i_2,'current i2 in amperes')
+//Method 2: To transform voltage source and R_1 into a current source in parallel with R_1
+i_s_2=V_s_1/R_1; //source transformation
+i_t=i_s_2+i_s_1; //total current
+i_2=R_1*i_t/(R_1+R_2) //current-division principle
+i_1=i_2-i_s_1; //KCL at top node of original circuit
+disp('By voltage source to current source transformation:')
+disp(i_1,'current i1 in amperes')
+disp(i_2,'current i2 in amperes')
+disp('In any method we get the same answers.')
+
diff --git a/887/CH2/EX2.21/2_21.sce b/887/CH2/EX2.21/2_21.sce
new file mode 100755
index 000000000..706586c40
--- /dev/null
+++ b/887/CH2/EX2.21/2_21.sce
@@ -0,0 +1,15 @@
+clc
+//ex2.21
+V_s=50;
+R_1=20;
+R_2=5;
+//Zeroing the voltage source
+R_eq=1/((1/R_1)+(1/R_2)); //R_1 and R_2 in parallel
+R_t=R_eq; //thevenin resistance
+//open-circuit analysis
+V_oc=V_s*R_2/(R_1+R_2); //open-circuit voltage
+V_t=V_oc; //thevenin voltage
+R_L=R_t;
+P_L_max=V_t^2/(4*R_t)
+disp(R_L,'load resistance for maximum power transfer in ohms')
+disp(P_L_max,'maximum power in watts')
diff --git a/887/CH2/EX2.22/2_22.sce b/887/CH2/EX2.22/2_22.sce
new file mode 100755
index 000000000..5eed2463d
--- /dev/null
+++ b/887/CH2/EX2.22/2_22.sce
@@ -0,0 +1,14 @@
+clc
+//ex2.22
+V_s=15; //voltage source
+R_1=10;
+R_2=5;
+i_s=2; //current source
+//Analysis with only voltage source active
+V_1=R_2*V_s/(R_1+R_2); //voltage-division principle
+//Analysis with only current source active
+R_eq=1/((1/R_1)+(1/R_2)); //R_1 and R_2 in parallel
+V_2=i_s*R_eq; //ohm's law
+V_T=V_1+V_2; //total response
+printf(" All the values in the textbook are approximated hence the values in this code differ from those of Textbook")
+disp(V_T,'VT i.e., voltage across R2 in volts')
diff --git a/887/CH2/EX2.23/2_23.sce b/887/CH2/EX2.23/2_23.sce
new file mode 100755
index 000000000..97c319790
--- /dev/null
+++ b/887/CH2/EX2.23/2_23.sce
@@ -0,0 +1,23 @@
+clc
+//ex2.23
+R_1=1*10^3;
+//case (a)
+disp('case a:')
+R_2=10*10^3;
+R_3=732;
+R_x=R_2*R_3/R_1; //wheatstone bridge condition
+disp(R_x,'Value of Rx in ohms')
+//case (b)
+disp('case b:')
+//R_x is maximum when both R_2 and R_3 are maximum
+R_2_max=1*10^6;
+R_3_max=1100;
+R_x_max=R_2_max*R_3_max/R_1; //wheatstone bridge condition
+disp(R_x_max,'Maximum value of Rx in ohms')
+//case(c)
+disp('case c:')
+//increment in R_x is scale factor times increment in R_3
+R_2=1*10^6;
+R_3_inc=1; //increment in R_3
+R_x_inc=R_2*R_3_inc/R_1; //increment in R_x from bride balance condition
+disp(R_x_inc,'Increment between values of Rx in ohms for the bridge to be balanced')
diff --git a/887/CH2/EX2.3/2_3.sce b/887/CH2/EX2.3/2_3.sce
new file mode 100755
index 000000000..1c177c43c
--- /dev/null
+++ b/887/CH2/EX2.3/2_3.sce
@@ -0,0 +1,11 @@
+//ex2.3
+V_total=15;
+R_1=1*10^3;
+R_2=1*10^3;
+R_3=2*10^3;
+R_4=6*10^3;
+//By voltage-division priciple
+V_1=R_1*V_total/(R_1+R_2+R_3+R_4); //voltage across R_1
+V_4=R_4*V_total/(R_1+R_2+R_3+R_4); //voltage across R_4
+disp(V_1,'voltage across R_1')
+disp(V_4,'voltage across R_4')
diff --git a/887/CH2/EX2.4/2_4.sce b/887/CH2/EX2.4/2_4.sce
new file mode 100755
index 000000000..8e776d5c9
--- /dev/null
+++ b/887/CH2/EX2.4/2_4.sce
@@ -0,0 +1,14 @@
+clc
+//ex2.4
+V_s=100; //source current
+R_1=60;
+R_2=30;
+R_3=60;
+R_x=1/((1/R_2)+(1/R_3)); //R_2 and R_3 parallel
+V_x=R_x*V_s/(R_1+R_x); //voltage across R_x(voltage-division principle)
+i_s=V_s/(R_1+R_x); //ohm's law
+i_3=R_2*i_s/(R_2+R_3); //current through R_3(current-division principle)
+printf(" All the values in the textbook are approximated, hence the values in this code differ from those of Textbook")
+disp(V_x,'voltage across R2 or R3 in volts')
+disp(i_s,'source current in amperes')
+disp(i_3,'current through R3 in amperes')
diff --git a/887/CH2/EX2.5/2_5.sce b/887/CH2/EX2.5/2_5.sce
new file mode 100755
index 000000000..f4c104262
--- /dev/null
+++ b/887/CH2/EX2.5/2_5.sce
@@ -0,0 +1,17 @@
+clc
+//ex2.5
+i_s=15; //source current
+R_1=10;
+R_2=30;
+R_3=60;
+R_eq=1/((1/R_2)+(1/R_3)); //R_2 and R_3 in parallel
+i_1=R_eq*i_s/(R_1+R_eq); //current through R_1(current-division principle)
+disp(i_1,'current through R1 in amperes from resistance method')
+//we can also do the above calculations using conductances as shown below.
+//Conductances of respective resistances
+G_1=1/R_1;
+G_2=1/R_2;
+G_3=1/R_3;
+i_1=G_1*i_s/(G_1+G_2+G_3);
+disp(i_1,'current through R1 in amperes from conductance method')
+disp('We get the same alue in both methods')
diff --git a/887/CH2/EX2.6/2_6.sce b/887/CH2/EX2.6/2_6.sce
new file mode 100755
index 000000000..ccdfe62c3
--- /dev/null
+++ b/887/CH2/EX2.6/2_6.sce
@@ -0,0 +1,9 @@
+clc
+//ex2.6
+//we display the equations in scilab as follows
+disp('At node 1:')
+disp('(V1/R1)+((V1-V2)/R2)+i_s=0') //KCL at node 1
+disp('At node 2:')
+disp('((V2-V1)/R2)+(V2/R3)+((V2-V3)/R4)=0') //KCL at node 2
+disp('At node 3:')
+disp('(V3/R5)+((V3-V2)/R4))=i_s') //KCL at node 3
diff --git a/887/CH2/EX2.7/2_7.sce b/887/CH2/EX2.7/2_7.sce
new file mode 100755
index 000000000..0e4dd9e05
--- /dev/null
+++ b/887/CH2/EX2.7/2_7.sce
@@ -0,0 +1,12 @@
+clc
+//ex2.7
+disp('The matrix form is')
+disp('G*V=I')
+disp('where')
+G=[0.45,-0.25,0;-0.25,0.85,-0.20;0,-0.20,0.30];
+disp(G,'G=')
+disp('V=')
+disp('transpose of [V_1,V_2,V_3]')
+disp('and')
+I=[-3.5;3.5;2];
+disp(I,'I=')
diff --git a/887/CH2/EX2.8/2_8.sce b/887/CH2/EX2.8/2_8.sce
new file mode 100755
index 000000000..38728b771
--- /dev/null
+++ b/887/CH2/EX2.8/2_8.sce
@@ -0,0 +1,12 @@
+clc
+//ex2.8
+R=20;
+G=[0.35,-0.2,-0.05;-0.2,0.3,-0.1;-0.05,-0.1,0.35]; //coefficient matrix
+I=[0;10;0] //current matrix
+V=G\I; //voltage matrix(from G=V*I)
+i_x=(V(1)-V(3))/R;
+printf(" All the values in the textbook are approximated,hence the values in this code differ from those of textbook")
+disp(V(1),'voltage at node1 in volts')
+disp(V(2),'voltage at node2 in volts')
+disp(V(3),'voltage at node3 in volts')
+disp(i_x,'value of current ix in amperes')
diff --git a/887/CH2/EX2.9/2_9.sce b/887/CH2/EX2.9/2_9.sce
new file mode 100755
index 000000000..4d6aa76a5
--- /dev/null
+++ b/887/CH2/EX2.9/2_9.sce
@@ -0,0 +1,9 @@
+clc
+//ex2.9
+//we display the required equations as follows
+disp('Current equations at node1 and node2:')
+disp('((V1-V2)/5)+((V1-10)/2)=1')
+disp('(V2/5)+((V2-10)/10)+((V2-V1)/5)=0')
+disp('Writing the above equations in standard form')
+disp('0.7V1-0.2V2=6')
+disp('-0.2V1+0.5V2=1')