Hello people,
Does anyone know how to build a matrix like this one?
Thank you!

 采纳的回答

Ameer Hamza
Ameer Hamza 2020-10-22
编辑:Ameer Hamza 2020-10-22

0 个投票

Are you trying to create an upper tiangular matrix? Read about triu: https://www.mathworks.com/help/matlab/ref/triu.html

4 个评论

That was useful, but I want to index it as shown in the picture. Any idea how?
Are you trying to create something like this
H_alpha = [1 2 3 4];
M = zeros(numel(H_alpha));
for i = 1:numel(H_alpha)
M = M + diag(H_alpha(i)*ones(numel(H_alpha)-i+1, 1), 1-i);
end
Yeeees! Many thanks
I am glad to be of help! :)

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by