summaryrefslogtreecommitdiff
path: root/147/CH2/EX2.8/Example2_8.sce
diff options
context:
space:
mode:
Diffstat (limited to '147/CH2/EX2.8/Example2_8.sce')
-rw-r--r--147/CH2/EX2.8/Example2_8.sce19
1 files changed, 19 insertions, 0 deletions
diff --git a/147/CH2/EX2.8/Example2_8.sce b/147/CH2/EX2.8/Example2_8.sce
new file mode 100644
index 000000000..60121924d
--- /dev/null
+++ b/147/CH2/EX2.8/Example2_8.sce
@@ -0,0 +1,19 @@
+//Resistance R, Voltage V
+close();
+clear;
+clc;
+R1 = 6;//ohm
+R2 = 1;
+R3 = 2;
+R4 = 3;
+R5 = 10;
+V1 = 10;//V
+V2 = 20;
+//Solving Nodal equations
+A = [1/R1+1/R2+1/R3 -1/R3;-1/R3 1/R3+1/R4+1/R5];
+C = [V1/R1;V2/R5];
+B = inv(A)*C;
+V3 = B(1,1);
+V4 = B(2,1);
+I = (V4-V2)/R5;
+mprintf('I = %0.2f A',I); \ No newline at end of file