matlab上机试题(7)
发布时间:2021-06-06
发布时间:2021-06-06
d(i,j)=A(i,j); else
u(i,j)=-A(i,j); end end end
disp('增光矩阵') B=[A,b] G=inv(d-l)*u; d1=inv(d-l)*b; for j=1:1000 x1=G*x+d1; x=x1;x1=G*x+d1; if abs(x1-x)<0.0001 break; elseif j>1000
disp('迭代不收敛或迭代次数超出1000'); end end
(3)SOR迭代( 1.334,1.95,
function [x,j]=SOR(A,b,x0,w) n=length(b); l=zeros(n,n); u=zeros(n,n); x=x0; for i=1:n; for j=1:n; if i>j
l(i,j)=-A(i,j); elseif i==j d(i,j)=A(i,j); else
u(i,j)=-A(i,j); end end end
disp('曾广矩阵') B=[A,b]
G=inv(d-w*l)*((1-w)*d+w*u); d1=w*inv(d-w*l)*b; for j=1:1000 x1=G*x+d1; x=x1;x1=G*x+d1;
0.95)
上一篇:常识知识分类汇总
下一篇:单片机实验——秒表 (详细步骤)