Borrar filtros
Borrar filtros

Create upper triangular matrix using for loop in matlab

10 visualizaciones (últimos 30 días)
Elizabeth Brito
Elizabeth Brito el 4 de En. de 2021
Comentada: KALYAN ACHARJYA el 4 de En. de 2021
v = 1:6;
n = round((sqrt(8 * numel(v) + 1) - 1) / 2);
M = zeros(n, n);
c = 0;
for i2 = 1:n
for i1 = 1:i2
c = c + 1;
M(i1, i2) = v(c);
end
end
I found this code to make an upper triangular matrix, but I don't understand what the code is trying to say to make it work can someone explain to me
  2 comentarios
Elizabeth Brito
Elizabeth Brito el 4 de En. de 2021
Or could you tell me another way to make an upper triangular array with a for loop

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by