B = bandwidth(A,type) returns
the bandwidth of
matrix A specified by type.
Specify type as 'lower' for
the lower bandwidth, or 'upper' for the upper bandwidth.

The upper and lower bandwidths of a matrix
are measured by finding the last diagonal (above or below the main
diagonal, respectively) that contains nonzero values.

That is, for a matrix A with elements A_{ij}:

The upper bandwidth B_{1} is
the smallest number such that $${A}_{ij}=0$$ whenever $$j-i>{B}_{1}$$.

The lower bandwidth B_{2} is
the smallest number such that $${A}_{ij}=0$$ whenever $$i-j>{B}_{2}$$.

Note that this measurement does not disallow intermediate diagonals
in a band from being all zero, but instead focuses on the location
of the last diagonal containing nonzeros. By convention, the upper
and lower bandwidths of an empty matrix are both zero.