MATLAB: Matrix with gradually increasing!

matrix manipulation

Hi everyone! Can somebody help me to write a code to return a matrix with the following form: [1 1 1 1 1;1 1 1 1 0;1 1 1 0 0;1 1 0 0 0;1 0 0 0 0]? it's 5×5 square matrix Thanks in advance

Best Answer

flip(tril(ones(5)))
ans =
1 1 1 1 1
1 1 1 1 0
1 1 1 0 0
1 1 0 0 0
1 0 0 0 0