《Matlab线性方程组的迭代解法GaussSeidel迭代法.docx》由会员分享,可在线阅读,更多相关《Matlab线性方程组的迭代解法GaussSeidel迭代法.docx(1页珍藏版)》请在三一办公上搜索。
Matlab线性方程组的迭代解法GaussSeidel迭代法Matlab线性方程组的迭代解法Gauss-Seidel迭代法实验报告 1.熟悉Gauss-Seidel迭代法,并编写Matlab程序 function y,n=gauss_seidel(A,b,x0,eps) %gauss seidel iterative method to solve Ax=b if nargin=3 eps=1e-6; elseif nargin=eps x0=y; y=G*x0+f; n=n+1; end 2. 用Gauss-Seidel迭代法求解线性方程组。 输入: A=4 3 0;3 3 -1;0 -1 4; b=24;30;-24; x0=0;0;0; y,n=gauss_seidel(A,b,x0) 输出: y = 6 -2 -7 n = 4