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)?
답변 (1개)
Mubashar Sarfraz
2020년 8월 30일
0 개 추천
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.
카테고리
도움말 센터 및 File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!