diff options
Diffstat (limited to '1319/CH2/EX2.1')
-rw-r--r-- | 1319/CH2/EX2.1/2_1.sce | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/1319/CH2/EX2.1/2_1.sce b/1319/CH2/EX2.1/2_1.sce new file mode 100644 index 000000000..fe0e5d0dd --- /dev/null +++ b/1319/CH2/EX2.1/2_1.sce @@ -0,0 +1,36 @@ +// To determine the current using loop analysis
+
+clc;
+clear;
+
+// MESH Equations
+//6*i1-2*i2=30
+//-2*i1+6*i2=-40
+
+R=[6 -2;-2 6];
+E=[30;-40];
+
+//The Loop Currents
+
+I=inv(R)*E; // Matrix Method to solve for two unknowns in two eaquations.
+
+i1=I(1);
+i2=I(2);
+i3=i1-i2;
+
+disp('A',i2,'i2 =','A',i1,'i1 =','The Calculated Loop Currents are')
+
+disp('The Negative sign indicates that the assumed direction of flow of current should be reveresed.')
+
+if(i1<0);
+ i1=abs(i1);
+end
+
+if(i2<0);
+ i2=abs(i2);
+end
+
+disp('A',i1,'The Current through 4 ohm resistor on the 30V side =')
+disp('A',i2,'The Current through 4 ohm resistor on the 40V side =')
+disp('A',i3,'The Current through 2 ohm resistor =')
+
|