필터 지우기
필터 지우기

how row 10 is Working Specific "A(i,k+1:n) " ??

조회 수: 1 (최근 30일)
Raya Arafat
Raya Arafat 2020년 10월 26일
답변: Rohit Pappu 2020년 10월 29일
function [x,det] = gauss(A,b)
% Solves A*x = b by Gauss elimination and computes det(A).
% USAGE: [x,det] = gauss(A,b)
if size(b,2) > 1; b = b’; end % b must be column vector
n = length(b);
for k = 1:n-1 % elimination phase
for i= k+1:n
if A(i,k) ∼=0
lambda = A(i,k)/A(k,k);
A(i,k+1:n) = A(i,k+1:n) - lambda*A(k,k+1:n);
b(i)= b(i) - lambda*b(k);
end
end
end
if nargout == 2; det = prod(diag(A)); end
for k = n:-1:1 % back substitution phase
b(k) = (b(k) - A(k,k+1:n)*b(k+1:n))/A(k,k);
end; x = b;

답변 (1개)

Rohit Pappu
Rohit Pappu 2020년 10월 29일
Line no. 10 states that Update the (i)th row, (k+1)th to (n)th columns of A as follows
  • Multiply Lambda with the elements present in (k)th row, (k+1)th to (n)th columns of A to obtain a vector of dimensions (1, n-k)
  • Subtract the above resultant vector from the elements present in (i)th row, (k+1)th to (n)th columns of A to obtain a vector of dimensions (1, n-k)
  • Save the above resultant vector in (i)th row, (k+1)th to (n)th columns of A

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by