MATLAB: How to create this specified matrix

specific matrix create

Hi all. I have some values from U(1)…to…U(500) , and I need help to create this matrix:

Best Answer

One fast and easy way is to use toeplitz, it only needs one line of code:
>> U = 1:9;
>> toeplitz(U,[U(1),zeros(1,numel(U)-1)])
ans =
1 0 0 0 0 0 0 0 0
2 1 0 0 0 0 0 0 0
3 2 1 0 0 0 0 0 0
4 3 2 1 0 0 0 0 0
5 4 3 2 1 0 0 0 0
6 5 4 3 2 1 0 0 0
7 6 5 4 3 2 1 0 0
8 7 6 5 4 3 2 1 0
9 8 7 6 5 4 3 2 1
or
tril(toeplitz(U))