% Calculation of loop currents
%
% -----------------------------------------------------------------------------------
%
% (C) 2017, Krzysztof Sozanski, Digital Signal Processing in Power Electronics Control 
% Circuits, second edition, Springer-Verlag, London, 2017. 
% 
% -----------------------------------------------------------------------------------
%

R=[ 2.5 1.8 3 1 7] % value of resistors R1 to R5
E=[12 0 -5] % value of voltage sources E1, E2, E3
Z=[R(1)+R(2),-R(2),0; -R(2), R(2)+R(3)+R(4),-R(4); 0,-R(4), R(4)+R(5)];
J=Z\E % calculation of loop currents
