diff options
Diffstat (limited to '1319/CH2/EX2.22/2_22.sce')
-rw-r--r-- | 1319/CH2/EX2.22/2_22.sce | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/1319/CH2/EX2.22/2_22.sce b/1319/CH2/EX2.22/2_22.sce new file mode 100644 index 000000000..9298b47b5 --- /dev/null +++ b/1319/CH2/EX2.22/2_22.sce @@ -0,0 +1,36 @@ +//Current through 2 ohm resistor given a current source
+
+clc;
+clear;
+
+Is=2; // Current Source
+
+//Resistors connected directly to the current source
+Rs1=0.5;
+Rs2=0.5;
+
+//Resistors in various branches starting from the top
+R1=1;
+R2=1;
+R3=2;
+
+//Conversion to voltage sources
+V1=Rs1*Is; // Voltage across first half of the branch
+V2=Rs2*Is; // Voltage across second half of the branch
+
+// Voltage sources in the circuit
+V3=1;
+V4=2;
+
+//Characteristic Equations
+//2.5i1-1i2 = 2
+//-1i1+3.5i2 = 2
+
+R=[2.5 -1; -1 3.5]; // Resistor Vector
+V=[(V1+V3);(V2+V4-V3)]; // Voltage Vector
+I=inv(R)*V; // Current Vector
+i1=I(1);
+i2=I(2);
+
+printf('The Current through the 2 ohm resistor = %g A\n',i2)
+
|