声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 904|回复: 1

[编程技巧] 程序错误什么意思?(在线等 谢谢)

[复制链接]
发表于 2006-12-7 15:37 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
format long
>> broyden3([0.5 0.5 0.5])
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
回复
分享到:

使用道具 举报

 楼主| 发表于 2006-12-7 15:39 | 显示全部楼层
但是用这个 程序(拟牛顿法)解2元非齐次方程时    是正确的     三元时出现上面的错误提示!!
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-9-24 23:29 , Processed in 0.054781 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表