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

Ricardo López
Ricardo López 2020년 10월 22일
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
Ricardo López
Ricardo López 2020년 10월 22일
Yeeees! Many thanks
Ameer Hamza
Ameer Hamza 2020년 10월 22일
I am glad to be of help! :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

질문:

2020년 10월 22일

댓글:

2020년 10월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by