Gauss Elimination - making my upper triangular matrix
Afficher commentaires plus anciens
Hi I was trying to figure out how to make the upper triangular matrix for a matrix of unspecified length (nxn), but my line 7 keeps getting an error and I can't seem to figure out why. Please help thank youu and my code is below!!
function[x]=Gauss(a,b)
B=[a b];
n=length(b);
for j= 1:n
B=sortrows(B(j:n),'descend');
for i=j+1:n
B(i,:)=B(i,:)-((B(i,j)*B(j,:))/B(j,j));
end
end
Errors:
Index in position 1 exceeds array bounds. Index must not exceed 1.
Error in Gauss (line 7)
B(i,:)=B(i,:)-(B(i,j)/B(j,j))*B(j,:);
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!