How can I create a triangular matrix based on a vector, in MATLAB?

前端 未结 4 2223
渐次进展
渐次进展 2021-02-20 02:55

Let\'s say I\'ve got a vector like this one:

A = [101:105]

Which is really:

[ 101, 102, 103, 104, 105 ]

And I

4条回答
  •  野性不改
    2021-02-20 03:15

    For generating such triangular matrices with such a regular pattern, use the toeplitz function, e.g.

    m=toeplitz([1,0,0,0],[1,2,3,4])
    

    for the other case, use rot90(m)

提交回复
热议问题