% this program computes the nodal voltages
% given the admittance matrix Y and current vector I
% Y is the admittance matrix
% I is the current vector
% U is the nodal voltage vector
% initialize matrix Y and vector I using YU=I form
Y = [ 0.15    -0.1     -0.05;
     -0.1      0.145   -0.025;
     -0.05    -0.025    0.075];
I = [5; 0; 2];
% solution for the voltages
disp('The nodal voltages U1, U2 and U3 are')
U = inv(Y)*I
