How do I generate a given Matrix in one command?
1 次查看(过去 30 天)
显示 更早的评论
I have to generate a matrix
A=[1 8 0 0 0 0;-1 2 8 0 0 0;0 -1 3 8 0 0; 0 0 -1 4 8 0;0 0 0 -1 5 8;0 0 0 0 -1 6
] writing a single command. How do i solve this exercise in best way?
0 个评论
回答(1 个)
Daniel M
2019-11-7
T = toeplitz([1 -1 0 0 0 0],[1 8 0 0 0 0])+diag(0:5)
2 个评论
John D'Errico
2019-11-7
Please try to not do homework assignments for people. Guide them to a solution if you wish. But just doing their homework teaches them nothing but that they can use answers to have their work done for them.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!