function amat = srcAcc(i,j,val,bmat) %srcAcc(i,j,val,bmat) % Accumulates Is or Vs values onto source matrix bmat. % Index i is "from" node (drop mesh). % Index j is "to" node (rise mesh). if (j > 0) bmat(j)=bmat(j)+val; end if (i > 0) bmat(i)=bmat(i)-val; end amat=bmat;