资源描述:
《现代数值计算方法(matlab版)第2章(3)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、福建师范大学yêO{数计学院1/16JJII1Ù)5§
2、S{JIBackClose1Ù)5§
3、S{福建师范大学数计学院§2.3pd-mS{2/16§2.3.1Súª9ÙÏ^§SéJacobiS{XeUCµSÄk^x(k)=(x(k),x(k),12(k)T(k+1)(k+1)···,xn)JacobiS1§¦x1,¦x1 ,^(k+1)(k)(k+1)(k)(k)Tx1Ox1,^(x1,x2,···,xn)JacobiS1JJ(k+1)(k+1)(k)(k+1)(k+1)(k
4、)§¦x,¦x ,=Ox,^(x,x,x,222123II(k)T(k+1)···,xn)JacobiS1n§¦x3,XdÅO,Jx(k)¤k©þO¤,=x(k+1).ù«UCQ±!I;þ,?§q©B,ùÒ´pd-m(Gauss-Seidel)S.BackCloseéu5ê§
5、(2.1),Gauss-SeidelSOª1Xi−1Xn(k+1)(k+1)(k)xi=bi−aijxj−aijxj,i=1,2,···,n.(2.14)aii福建师范大学j=1j=i+1数计学院Bu
6、Âñ5©Û,ò©þ/ªSúª(2.14)U¤Ý3/16/ª.-a11aD=22,...annJJII0J−a210L=.......,I..Back−an1−an2···0Close0−a12···−a1n0···−a2nU=.....,.福建师范大学数计学院04/16KA=D−L−U.S(2.14)L«(k+1)(k+1)(k)Dx=Lx+Ux+b,Gauss-SeidelSÝL«(k+1)−1(k)−1x=(D−L)
7、Ux+(D−L)b,(2.15)JJ{PII(k+1)(k)x=BSx+fS,(2.16)JÙ¥B=(D−L)−1U,f=(D−L)−1b.SSIBacke¡ÑGauss-SeidelS{äN{Ú½µClose{2.2(Gauss-SeidelS{)Ú1ÑÝA,màþb,Щ:x(0),°Ý¦ε,SgêN,k:=0¶福建师范大学数计学院Ú2O5/16Xn(0)x1=b1−a1jxja11,j=2Xi−1Xn(0)xi=bi−aijxj−aijxjaii,i=2,···,n−1,j=1
8、j=i+1Xn−1xn=bn−anjxjannJJj=1IIÚ3ekx−x(0)k≤ε,KÊ,ÑÑx§
9、Cq)¶J∞IÄK,=Ú4.BackÚ4ek=N,KÊ,ÑÑS}&E¶ÄKx(0):=Closex,k:=k+1,=Ú2.â{2.2,?MATLAB§SXeµ福建师范大学数计学院•Gauss-SeidelS{MATLAB§S6/16%maseidel.mfunctionx=maseidel(A,b,x0,ep,N)%^å:^Gauss-SeidelS{)5§
10、Ax=b%ª:x=maseid
11、el(A,b,x0,ep,N)AXêÝ,bmà%þ,x0Щþ(%@"þ),ep°Ý(%@1e-6),JJ%NSgê(%@500g),x£Cq)þIIn=length(b);Jifnargin<5,N=500;endIifnargin<4,ep=1e-6;endBackCloseifnargin<3,x0=zeros(n,1);endx=zeros(n,1);k=0;whilek12、1,1);elseifi==nx(n)=(b(n)-A(n,1:n-1)*x(1:n-1))/A(n,n);elsex(i)=b(i)-A(i,1:i-1)*x(1:i-1)-A(i,i+1:n)*x0(i+1:n);JJIIx(i)=x(i)/A(i,i);JendIendBackCloseendifnorm(x-x0,inf)13、r(k)])~2.3^Gauss-SeidelS{Ï^§Smaseidel.m)5§
14、µJJ0.76−0.01−0.14−0.16x10.68II−0.010.88−0.030.06x21.18J=−0.14−0.031.01−0.12x30.12I−0.160.06−0.120.72x40.74BackCloseЩ:x(0)=(0,0,0,0)T,°Ý¦ε=10−6.)3MATL