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

11 views (last 30 days)
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 Comments
奥 刘
奥 刘 on 17 Nov 2021
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)];

Sign in to comment.

Answers (0)

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!