How do I generate an arbitrary (size n) triangular matrix with a vector?
For example:
A=[1;2;3;4;5;6;7;8;9;10];
And the answer should be:
B=[1,2,3,4; 0,5,6,7; 0,0,8,9; 0,0,0,10]
or
C=[1,2,3,4; 2,5,6,7; 3,6,8,9; 4,7,9,10]
I have already tried hankel, triu and other functions of MATLAB, did not work out.
Thank you in advance.