A = [3 -1 2; -2 4 1; 5 2 -3]; b = [1; 2; 3]; [L, U, P] = luDecomp(A); % P is permutation matrix
I’ve put together an explanatory piece based on the context of (and its solution) from the Solution Manual for Jaan Kiusalaas’ Numerical Methods in Engineering with MATLAB , 2nd Edition.
The decomposition yields (as shown in manual):