循环使用fsolve的问题
本帖最后由 hebut 于 2011-10-8 11:06 编辑对一个八元二次方程组进行循环求解;方程组里有一些数是每次循环求的的
每次进行一次循环,主程序求出这些已知量,然后保存成mat文件,在子程序中load使用
现在的问题是:不论设置初值是多少,fsolve都几乎不做迭代求解会提示已经找到根
提示如下:
First-Order Norm of
IterationFunc-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
IterationFunc-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
IterationFunc-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
IterationFunc-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
IterationFunc-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
IterationFunc-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
IterationFunc-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.
待求函数如下:
其中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_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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)]; 你好,我现在也碰到了相同问题,
http://forum.vibunion.com/forum.php?mod=viewthread&tid=129365
请问你以前是如何解决的?
页:
[1]