%FORWARDC Forward substitution for lower triangular systems % using a column-oriented implementation. % Written by on function x = forwardC( A, b ) [m,n] = size(A); if m~=n, % check if # rows ~= # columns in A error('The input matrix, A, is not a square matrix.') end x(1) = b(1)/A(1,1); if m>1, x(2:m) = forwardC( A(2:m,2:n), b(2:m)-x(1)*A(2:m,1) ); end x = x'; % convert and display result as column