Gauss Elimination - making my upper triangular matrix
Mostrar comentarios más antiguos
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,:);
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Matrix Indexing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!