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!