- 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
how row 10 is Working Specific "A(i,k+1:n) " ??
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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;
0 Kommentare
Antworten (1)
Rohit Pappu
am 29 Okt. 2020
Line no. 10 states that Update the (i)th row, (k+1)th to (n)th columns of A as follows
0 Kommentare
Siehe auch
Kategorien
Mehr zu Linear Algebra finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!