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

 Respuesta aceptada

Ameer Hamza
Ameer Hamza el 22 de Oct. de 2020
Editada: Ameer Hamza el 22 de Oct. de 2020

0 votos

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

4 comentarios

Ricardo López
Ricardo López el 22 de Oct. de 2020
That was useful, but I want to index it as shown in the picture. Any idea how?
Ameer Hamza
Ameer Hamza el 22 de Oct. de 2020
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 el 22 de Oct. de 2020
Yeeees! Many thanks
Ameer Hamza
Ameer Hamza el 22 de Oct. de 2020
I am glad to be of help! :)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Preguntada:

el 22 de Oct. de 2020

Comentada:

el 22 de Oct. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by