cannor 发表于 2006-12-7 15:37

程序错误什么意思?(在线等 谢谢)

format long
>> broyden3()
Warning: Matrix is close to singular or badly scaled.
         Results may be inaccurate. RCOND = 1.445765e-032.
> In broyden3 at 7
Warning: Matrix is close to singular or badly scaled.
         Results may be inaccurate. RCOND = 7.866780e-063.
> In broyden3 at 7
Warning: Matrix is close to singular or badly scaled.
         Results may be inaccurate. RCOND = 1.486740e-112.
> In broyden3 at 7
Warning: Matrix is singular, close to singular or badly scaled.
         Results may be inaccurate. RCOND = NaN.
> In broyden3 at 7

其中   broyden3 at 7 指的语句为   x1=x0-ft(x0)/a;


可能是除以矩阵时舍入误差太大了      有没有什么办法减少舍入误差在矩阵中的叠加   编写的程序为:

function y=broyden3(x0) % y=broyden(x0)x0为初值.
a=eye(length(x0));
x1=x0-ft(x0)/a;
n=1;
while (norm(x1-x0)>=1.0e-6)&(n<=100000000)
    x0=x1;
    x1=x0-ft(x0)/a;
    p=x1-x0;q=ft(x1)-ft(x0);
    a=a+(q-p*a)'*p/norm(p);
    n=n+1;
end
y=x1;
n

cannor 发表于 2006-12-7 15:39

但是用这个 程序(拟牛顿法)解2元非齐次方程时    是正确的   三元时出现上面的错误提示!!
页: [1]
查看完整版本: 程序错误什么意思?(在线等 谢谢)