Transform an upper triangular matrix MATLAB

后端 未结 1 1939
旧时难觅i
旧时难觅i 2021-01-21 08:41

If I have an upper triangular matrix on MATLAB LIKE

A =

    1 2 3 4
    0 5 6 7
    0 0 8 9
    0 0 0 1

How would you convert it to:

相关标签:
1条回答
  • 2021-01-21 09:22

    a = A + triu(A, 1)' does what you want (assuming real matrices or you want a Hermitian matrix for complex values).

    0 讨论(0)
提交回复
热议问题