Create triangular matrix from vector
12 次查看(过去 30 天)
显示 更早的评论
I have a vector, v = [x1, x2, x3 ....,xn]
I want to create a matrix from it in two ways: Upper triangular
x1 x2 x3.... xn
0 x2 x3 .... xn
0 0 x3 .....xn
. . . . . . ...
0 0 0 . . . . xn
Next, lower triangular:
x1 0 0 . .. 0
x1 x2 0 .... 0
. . . . .
x1 x2 .........xn
How can I do it without loops and conditional statements ?
Thank you.
2 个评论
Scott MacKenzie
2021-7-8
This looks like a homework question. Have you tried any possible solutions? Please post what you have tried and ask a specific question about what you don't understand.
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!