- 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 view (last 30 days)
Show older comments
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 Comments
Answers (1)
Rohit Pappu
on 29 Oct 2020
Line no. 10 states that Update the (i)th row, (k+1)th to (n)th columns of A as follows
0 Comments
See Also
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!