% ========================================================================== % electrical.m -- Compute currents in an electrical circuit % % Matrices : Resist = Rows represents resistors in each loop. % : Voltage = Voltage gain in each loop provided by battery. % : Current = Current in each loop. % % ========================================================================== % Setup matrix for "resistances in circuit loops" Resist = [ 11 -3 0; -3 13 -4; 0 -4 14 ] % Setup matrix for "voltage gains" in circuit loops Voltage = [ 10; 0; 0 ] % Solve equations and print currents Current = Resist\Voltage % ============================================================ % the end!