summaryrefslogtreecommitdiff
path: root/1319/CH2/EX2.4/2_4.sce
diff options
context:
space:
mode:
authorprashantsinalkar2017-10-10 12:27:19 +0530
committerprashantsinalkar2017-10-10 12:27:19 +0530
commit7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 (patch)
treedbb9e3ddb5fc829e7c5c7e6be99b2c4ba356132c /1319/CH2/EX2.4/2_4.sce
parentb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (diff)
downloadScilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.gz
Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.bz2
Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.zip
initial commit / add all books
Diffstat (limited to '1319/CH2/EX2.4/2_4.sce')
-rw-r--r--1319/CH2/EX2.4/2_4.sce40
1 files changed, 40 insertions, 0 deletions
diff --git a/1319/CH2/EX2.4/2_4.sce b/1319/CH2/EX2.4/2_4.sce
new file mode 100644
index 000000000..eca2c552d
--- /dev/null
+++ b/1319/CH2/EX2.4/2_4.sce
@@ -0,0 +1,40 @@
+// To calculate current from a battery and pd across points A and B
+
+clc;
+clear;
+
+// Resistances in the given network
+R1=4;
+R2=2;
+R3=3;
+R4=6;
+R5=8;
+
+// MESH Equations
+//9*i1-5*i2=10
+//-5*i1+19*i2=0
+
+// Supply voltage 10V
+
+R=[(R1+R2+R3) -(R2+R3); -(R2+R3) (R2+R3+R4+R5)];
+V=[10;0];
+
+//Loop Currents
+I=inv(R)*V;
+
+i1=I(1);
+i2=I(2);
+
+i3=i1-i2; // From Mesh 1
+
+// Point Voltages
+Va=i3*R3;
+Vb=i2*R5;
+
+disp('amperes',abs(i1),'The current through 4 ohm resistor and the battery =')
+disp('amperes',abs(i2),'The current through 6 ohm and 8 ohm resistors =')
+disp('amperes',abs(i3),'The current through 2 ohm and 3 ohm resistors =')
+
+disp('volts',abs(Va),'The voltage at point A =')
+disp('volts',abs(Vb),'The voltage at point B =')
+disp('volts',(Va-Vb),'The voltage across Points A and B =')