You can do it with toeplitz
and tril
;
a = [1 2 3 4 5]
out = tril( toeplitz(a) )
or
out = toeplitz(a, a*0)
%// out = toeplitz(a, zeros(size(a)) ) %// for large arrays
or if you don't mind some happy flipping:
out = flipud( hankel( flipud(a(:)) ) )
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…