1. function is_real_matrix(M)
count=0;
for i=M
if(!isreal(i))
fprintf("
The matrix has non real entries.")
count=count+1;
endif
endfor
if(!count)
fprintf("
The matrix is real !
")
endif
endfunction
2. function is_complex_matrix(M)
count=0;
for i=M
if(iscomplex(i))
fprintf("
The matrix has complex entries.")
count=count+1;
endif
endfor
if(!count)
fprintf("
The matrix is not complex!
")
endif
endfunction
3. function is_diagonal_matrix(M)
[c,d]=size(M)
if(c-d)
fprintf("
The matrix is not square
")
elseif (!(c-d))
if(isdiag(a))
fprintf("
The matrix is diagonal!
")
else
fprintf("
It is not diagonal!
")
endif
endif
endfunction
4. function is_lower_triangular_matrix(M)
[c,d]=size(M)
if(c-d)
fprintf("
The matrix is not square
")
elseif (!(c-d))
if(istril(a))
fprintf("
The matrix is lower triangular!
")
else
fprintf("
It is not lower triangular!
")
endif
endif
endfunction