查看单个帖子
旧 2008-10-21, 20:54   #1
feng-wuyun
初级会员
 
注册日期: 2008-10-21
年龄: 39
帖子: 1
声望力: 0
feng-wuyun 正向着好的方向发展
默认 [求助]Matlab报错了

function Gauss_Matrix(A,b,x0,Nmax,eps)
D=diag(diag(A));
U=-triu(A,1);
L=-tril(A,-1);
G=(D-L)\U;
f=(D-L)\b;
y=G*x0+f;
n=1;
while norm(y-x0)>=eps
x0=y;
y=G*x0+f;
n=n+1;
if n==Nmax
'bushoulian'
return
end
end
y
n
A=[8.714 2.180 5.684;-1.351 10.724 5.684;2.489 -0.459 6.799];
b=[49.91 50.77 32.68];
GaussSeidel(A,b,[0 0 0]',500,0.00001)
??? Error using ==> mldivide
Matrix dimensions must agree.

Error in ==> JacobiMatrix at 6
f=D\b;
feng-wuyun 当前离线   回复时引用此帖