What does this syntax do in a matrix within a for loop
Ältere Kommentare anzeigen
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)?
Antworten (1)
Mubashar Sarfraz
am 30 Aug. 2020
0 Stimmen
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.
Kategorien
Mehr zu Operators and Elementary Operations finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!