How to generate 4x4 lower triangular matrix?
Mostrar comentarios más antiguos
I want to generate the lower triangular matrix A1 using a for loop instead of using for example 'B(2) - B(1)' for a22 and so on in the matrix.
MATLAB
B = [17.000; 26.000; 29.000; 33.000];
A1 = [1 0 0 0; 1 T(2)-T(1) 0 0; 1 T(3)-T(1) (T(3)-T(1))*(T(3)-T(2)) 0;
1 T(4)-T(1) (T(4)-T(1))*(T(4)-T(2)) (T(4)-T(1))*(T(4)-T(2))*(T(4)-T(3))]; %Lower Triangular Matrix
end
Respuestas (1)
Andrei Bobrov
el 30 de Nov. de 2017
a = tril(T(:) - T(:)');
A1 = cumprod([ones(numel(T),1),a(:,1:end-1)],2);
Categorías
Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!