声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1888|回复: 2

[综合讨论] 循环使用fsolve的问题

[复制链接]
发表于 2011-10-8 11:04 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 hebut 于 2011-10-8 11:06 编辑

对一个八元二次方程组进行循环求解;方程组里有一些数是每次循环求的的
每次进行一次循环,主程序求出这些已知量,然后保存成mat文件,在子程序中load使用
现在的问题是:不论设置初值是多少,fsolve都几乎不做迭代求解会提示已经找到根
提示如下:
                                       First-Order                    Norm of
Iteration  Func-count    Residual       optimality      Lambda           step
     0           9    1.10716e-011       1.09e-011         0.01
     1          18    1.10716e-011       1.09e-011        0.001   1.54531e-009
Optimization terminated: the relative change in the sum-of-squares of the functions is less than options.TolFun
                                        First-Order                    Norm of
Iteration  Func-count    Residual       optimality      Lambda           step
     0           9    1.91064e-011               0         0.01
Optimization terminated: the first-order optimality measure is less than 1e-4 times options.TolFun.
                                        First-Order                    Norm of
Iteration  Func-count    Residual       optimality      Lambda           step
     0           9    1.80203e-009               0         0.01
Optimization terminated: the first-order optimality measure is less than 1e-4 times options.TolFun.
                                        First-Order                    Norm of
Iteration  Func-count    Residual       optimality      Lambda           step
     0           9    3.46033e-007               0         0.01
Optimization terminated: the first-order optimality measure is less than 1e-4 times options.TolFun.
                                        First-Order                    Norm of
Iteration  Func-count    Residual       optimality      Lambda           step
     0           9    8.02442e-007               0         0.01
Optimization terminated: the first-order optimality measure is less than 1e-4 times options.TolFun.
                                        First-Order                    Norm of
Iteration  Func-count    Residual       optimality      Lambda           step
     0           9    1.01221e-006               0         0.01
Optimization terminated: the first-order optimality measure is less than 1e-4 times options.TolFun.
                                        First-Order                    Norm of
Iteration  Func-count    Residual       optimality      Lambda           step
     0           9    4.86868e-006               0         0.01
Optimization terminated: the first-order optimality measure is less than 1e-4 times options.TolFun.
回复
分享到:

使用道具 举报

 楼主| 发表于 2011-10-8 11:08 | 显示全部楼层
待求函数如下:
其中x(1)到x(8)为未知数,其余量为已知数,从主程序中获得的
F = [Gapap_1-Gapap_2-2*Ganap_1_re*x(1)+2*Ganap_2_re*x(1)+(Ganan_1-Ganan_2)*x(1)*x(1)+2*(Ganap_1_im-Ganap_2_im)*x(2)+(Ganan_1-Ganan_2)*x(2)*x(2)-2*Gbnap_1_re*x(3)+2*Gbnap_2_re*x(3)+2*Ganbn_1_re*x(1)*x(3)-2*Ganbn_2_re*x(1)*x(3)-2*Ganbn_1_im*x(2)*x(3)+2*Ganbn_2_im*x(2)*x(3)+Gbnbn_1*x(3)*x(3)-Gbnbn_2*x(3)*x(3)+2*(Gbnap_1_im-Gbnap_2_im+Ganbn_1_im*x(1)-Ganbn_2_im*x(1)+Ganbn_1_re*x(2)-Ganbn_2_re*x(2))*x(4)+(Gbnbn_1-Gbnbn_2)*x(4)*x(4);

Gapbp_1_re-Gapbp_2_re-Ganbp_1_re*x(1)+Ganbp_2_re*x(1)+Ganbp_1_im*x(2)-Ganbp_2_im*x(2)-Gbnbp_1_re*x(3)+Gbnbp_2_re*x(3)+Gbnbp_1_im*x(4)-Gbnbp_2_im*x(4)-Ganap_1_re*x(5)+Ganap_2_re*x(5)+Ganan_1*x(1)*x(5)-Ganan_2*x(1)*x(5)+Ganbn_1_re*x(3)*x(5)-Ganbn_2_re*x(3)*x(5)+Ganbn_1_im*x(4)*x(5)-Ganbn_2_im*x(4)*x(5)+Ganap_1_im*x(6)-Ganap_2_im*x(6)+Ganan_1*x(2)*x(6)-Ganan_2*x(2)*x(6)-Ganbn_1_im*x(3)*x(6)+Ganbn_2_im*x(3)*x(6)+Ganbn_1_re*x(4)*x(6)-Ganbn_2_re*x(4)*x(6)-Gbnap_1_re*x(7)+Gbnap_2_re*x(7)+Ganbn_1_re*x(1)*x(7)-Ganbn_2_re*x(1)*x(7)-Ganbn_1_im*x(2)*x(7)+Ganbn_2_im*x(2)*x(7)+Gbnbn_1*x(3)*x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3_im*x(2)-Gbnbn_2*x(3)+Gbnbn_3*x(3))*x(8);

Gbpbp_2-Gbpbp_3-2*Ganbp_2_re*x(5)+2*Ganbp_3_re*x(5)+Ganan_2*x(5)*x(5)-Ganan_3*x(5)*x(5)+2*Ganbp_2_im*x(6)-2*Ganbp_3_im*x(6)+Ganan_2*x(6)*x(6)-Ganan_3*x(6)*x(6)-2*Gbnbp_2_re*x(7)+2*Gbnbp_3_re*x(7)+2*Ganbn_2_re*x(5)*x(7)-2*Ganbn_3_re*x(5)*x(7)-2*Ganbn_2_im*x(6)*x(7)+2*Ganbn_3_im*x(6)*x(7)+Gbnbn_2*x(7)*x(7)-Gbnbn_3*x(7)*x(7)+2*(Gbnbp_2_im-Gbnbp_3_im+Ganbn_2_im*x(5)-Ganbn_3_im*x(5)+Ganbn_2_re*x(6)-Ganbn_3_re*x(6))*x(8)+(Gbnbn_2-Gbnbn_3)*x(8)*x(8)];
发表于 2013-11-4 15:08 | 显示全部楼层
你好,我现在也碰到了相同问题,
http://forum.vibunion.com/forum.php?mod=viewthread&tid=129365
请问你以前是如何解决的?
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

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

GMT+8, 2024-5-5 19:34 , Processed in 0.050114 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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