数值9(迭代法收敛性证明)精读.ppt

garon2矩阵稀疏模式 2D FEM, Navier-Stokes, CFD n=10000;e = ones(n,1); n2=n/2; a = spdiags([-e 3*e -e],-1:1,n,n); c=spdiags([e/2],0,n,n);c=fliplr(c);a=a+c; a(n2+1,n2) = -1; a(n2,n2+1) = -1; b=zeros(n,1); b(1)=2.5;b(n)=2.5;b(2:n-1)=1.5;b(n2:n2+1)=1; %%% Jacobi Method (Iterative Method) tic d=diag(a); % extract diagonal of a r=a-diag(d); % r is the remainder x=zeros(n,1); % initialize vector x for j=1:50 % loop for Jacobi iteration x = (b-r*x)./d; end t1=toc tic,x=full(a)\b,t2=toc %% Back Slash (Direct Method) Demo1 help sparfun Matlab与大数据处理 Elementary sparse matrices (例如sp

文档评论(0)

1亿VIP精品文档

相关文档