Gaussian Elimination with Pivoting Method

版本 1.0.0.0 (4.1 KB) 作者: Cheuk
Function uses Gauss elimination with pivoting to solve a linear system in standard format.
4.1K 次下载
更新时间 2014/2/5

查看许可证

This function solves a linear system Ax=b using the Gaussian elimination method with pivoting. The algorithm is outlined below:
1) Initialize a permutation vector r = [1, 2,...,n] where r(i) corresponds to row i in A.
2) For k = 1,...,n-1 find the largest (in absolute value) element among a(r(k),k),a(r(k+1),k),...,a(r(n),k).
3) Assume r(j,k) is the largest element. Switch r(j) and r(k).
4) For i=1,...,k-1,k+1,...,n calculates:
zeta = a(r(i),k) / a(r(k),k)
5) For j=k,...,n calculate:
a(r(i),j)=a(r(i),j)-a(r(k),j)*zeta
b(r(i)) = b(r(i))-b(r(k))*zeta
6) Steps 1 through 6 has effectively diagonalized A.
7) Each element in the solution vector is:
x(r(i)) = b(i)/a(i,i);

Reference:
(1) http://mathworld.wolfram.com/GaussianElimination.html

引用格式

Cheuk (2024). Gaussian Elimination with Pivoting Method (https://www.mathworks.com/matlabcentral/fileexchange/45415-gaussian-elimination-with-pivoting-method), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2011a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Numerical Integration and Differential Equations 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0.0