Explorar o código

Finish the Kirchhoff law problem

Pjotir hai 1 mes
pai
achega
06b366028f
Modificáronse 1 ficheiros con 13 adicións e 0 borrados
  1. 13 0
      Homework2/problem4_kitchoffslaw.m

+ 13 - 0
Homework2/problem4_kitchoffslaw.m

@@ -0,0 +1,13 @@
+% Equations
+% 40V = 1(I1) + 7(I1-I2) + 4(I1-I4) -> 12(I1) - 7(I2) - 4(I4) = 40V
+% 30V = 2(I2) + 6(I2-I3) + 7(I2-I1) -> -7(I1) + 8(I2) - 6(I3) = 30V
+% 20V = 3(I3) + 5(I3-I4) + 6(I3-I2) -> -6(I2) + 14(I3) - 5(I4) = 20V
+% -10V = 4(I4) + 4(I4-I1) + 5(I4-I3) -> -4(I1) - 5(I3) +13(I4) = -10V
+
+A = [12 -7  0 -4;
+     -7 15 -6  0;
+      0 -6 14 -5;
+     -4  0 -5 13]
+B = [40;30;20;-10]
+
+I = A \ B