isbandedDetermine if a matrix is banded
isbanded(A, l, u)A should be a numeric array.l and u should be non-negative real integer scalars not equal to Inf nor NaN.u-th diagonal and elements lying strictly below the l-th diagonal are all zeros. It returns logical 0 if otherwise.A is empty.a = zeros([5 4]);
% 30% of the elements are non-zero (randomly generated)
i = randi(numel(a),1, ceil(numel(a)*.3));
a(i) = 7+7i
isbanded(a,3,1)
a =
0.000 + 0.000i 7.000 + 7.000i 0.000 + 0.000i 0.000 + 0.000i
0.000 + 0.000i 7.000 + 7.000i 0.000 + 0.000i 0.000 + 0.000i
0.000 + 0.000i 7.000 + 7.000i 0.000 + 0.000i 0.000 + 0.000i
7.000 + 7.000i 0.000 + 0.000i 0.000 + 0.000i 7.000 + 7.000i
0.000 + 0.000i 0.000 + 0.000i 0.000 + 0.000i 0.000 + 0.000i
ans =
1