%ex8_10.m
%2012/3/19
% Branch Current Method
% Loop 1: +15V - 4*I1  + 10I3 - 20V = 0
% Loop 2: +20V - 10*I3 - 5*I2 + 40V = 0
% KCL at Node a: I1 + I3 = I2
% 
% 1. Substitute I2 with (I1 + I3)
% 2. Rearrange the two loop equation
%
% -4*I1 + 10*I3 = 5
%  5*I1 + 15*I3  = 60
% Second Order Determinants to solve I1, and I3;
% Then obtain I2 = I1 + I3 
%
%       Colum Colum
%         1     2      
%      |  d11  d12  |  <== Row 1
%  D = |  d21  d22  |  <== Row 2
%
%  det(D) = (d11*d22) - (d21*d12) = -110
%        
%  det(num1) = -525
%  det(num3) = -265
D = [-4  10; ...
      5  15];
num1 = [5   10; ...
        60   15];
num3 = [-4   5; ...
         5   60];
I1 = det(num1)/det(D)   % 4.7727 A
I3 = det(num3)/det(D)   % 2.4091 A
I2 = I1 + I3            % 7.1818 A