Please Explain Gauss elimination Matlab Code
1 回表示 (過去 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!