对一个八元二次方程组进行循环求解;方程组里有一些数是每次循环求的的
每次进行一次循环,主程序求出这些已知量,然后保存成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.
待求函数如下:
其中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);