How to generate 4x4 lower triangular matrix?
Afficher commentaires plus anciens
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
Réponses (1)
Andrei Bobrov
le 30 Nov 2017
a = tril(T(:) - T(:)');
A1 = cumprod([ones(numel(T),1),a(:,1:end-1)],2);
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!