%% Tridiagonal Matrices
% A triadiagonal matrix has bandwidth of 3. One an use the diag function to construct a banded matrix.
%

diag([2,2,0,2,1,2],0)

%

diag([-1 -1 -1 -1 -1],1)

%

A=diag([2,2,0,2,1,2],0)+diag([-1 -1 -1 -1 -1],1)+diag([4 3 2 1 0],-1)

%
% In the case with no pivoting, L and U preserve the bandwidths.
%

[L,U]=lufact(A)