What does this syntax do in a matrix within a for loop

for i = 1:n-1
a = A(i+1:n,i)/A(i,i); %this gives us the coefficient for row operations
A(i+1:n,:)=A(i+1:n,:)-a*A(i,:); %performs row operations
b(i+1:n,:)=b(i+1:n,:)-a*b(i,:);
end
QUESTION: what is A from 1+1:n, what does that do? how is it different from A(i+1,i)?

Respuestas (1)

Mubashar Sarfraz
Mubashar Sarfraz el 30 de Ag. de 2020
i+1:n is basically taking rows of the matrix A from i+1 (if i=4, 4+1:n where n i max rows) to the last row. In the later A(i+1,i) is taking only a single row i.e. i+1, not the range of rows (i+1:n) as in the first one.

Categorías

Más información sobre Operators and Elementary Operations en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 30 de Ag. de 2020

Respondida:

el 30 de Ag. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by