Use the diag function
to produce diagonal matrices for which isdiag returns
logical 1 (true).

The functions isdiag, istriu,
and istril are special cases of the function isbanded, which can perform all of the
same tests with suitably defined upper and lower bandwidths. For example, isdiag(A)
== isbanded(A,0,0).