Please Explain Gauss elimination Matlab Code
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi I am new to Matlab below is the code provided by my university and I am finding difficulties in understanding the code at the highlighted areas I am well aware of Gauss elimination process and I am good at math manually but I am facing lot of problem in understanding the code for Gauss elimination I got some basic knowledge on matlab of how to save function and execute the program successfully
Can anyone explain the code from line no 5 I got stuck up in understanding the logic in the program sequence
Thanks in advance
function [x]=gauss1(A,b)
[n,m] = size(A);
if n~=m; error('A is not a square matrix'); else
% Forward elimination
for k = 1:n-1,
for i = k+1:n,
if A(k,k)==0, error('Null diagonal element'); end
r = A(i,k)/A(k,k);
b(i) = b(i)-r*b(k);
for j = k+1:n,
A(i,j) = A(i,j)-r*A(k,j);
end
end
end
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!