How to fix "fsolve stopped because it exceeded the function evaluation limit" while using fsolve function?

7 次查看(过去 30 天)
Recently, i'm trying to solve a nonlinear equation set by using "fsolve" . I created my personal function as the following:
function F = poSTAR_14(x,Hm_RI,at_RI,J)
F1=Hm_RI*x;
F2=at_RI*x-[1;0];
F3=x(1:J,1).^2+x(J+1:2*J,1).^2-ones(J,1);
F=[F1(:);F2(:);F3(:)];
end
Above is the function that contains 3 nonlinear equations and I saved it as a .m file with my main file.
Below is the part that I call the fsolve to solve my problem, where , are known vetors, is known scalar, initial point
Hm_R=real(Hm).*100;
Hm_I=imag(Hm).*100;
Hm_RI=[Hm_R,-Hm_I;Hm_I,Hm_R];
at_R=real(as_ele_Tx.');
at_I=imag(as_ele_Tx.');
at_RI=[at_R,-at_I;at_I,at_R];
w_R=real(conj(W_Tx));
w_I=imag(conj(W_Tx));
fun = @poSTAR_14;
x0 = [w_R;w_I];
x = fsolve(@(x)fun(x,Hm_RI,at_RI,J),x0);
But something is wrong with my code and the command window showed that,
Solver stopped prematurely.
fsolve stopped because it exceeded the function evaluation limit,
options.MaxFunctionEvaluations = 6.400000e+03.
Does it mean I should pick a better starting point or just set a larger "MaxFunctionEvaluations"?
I also modified the parameters as below,
options = optimoptions(@fsolve, 'MaxFunctionEvaluations', 10000, 'MaxIterations', 10000);
x = fsolve(@(x)fun(x,Hm_RI,at_RI,J),x0);
but the command window showed the same output.
So why it showed this output and how to fix it?
  6 个评论
奥 刘
奥 刘 2021-11-17
I attached the data files of Hm_RI and at_RI here.
as for the starting point x0, it can be achieved as,
weight0=ones(J,1).*exp(1j*(2*pi*randn(J,1)-pi));
w_R=real(conj(weight0));
w_I=imag(conj(weight0));
or just set it as
x0=[ones(J,1);zeros(J,1)];

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

产品


版本

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by