フィルターのクリア

Failure in initial objective function evaluation. FSOLVE cannot continue.

7 ビュー (過去 30 日間)
奥 刘
奥 刘 2021 年 11 月 11 日
編集済み: 奥 刘 2021 年 11 月 12 日
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)
F(1)=Hm_RI*x;
F(2)=at_RI*x-[1;0];
F(3)=abs(x(1:32,1)).^2+abs(x(33:64,1)).^2-ones(J,1);
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_R,Hm_I];
at_R=real(as_ele_Tx.');
at_I=imag(as_ele_Tx.');
at_RI=[at_R,-at_I;at_R,at_I];
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 It seems someting wrong with the size of my matrix in the problem formulation:
Unable to perform assignment because the indices on the left side are not compatible with the
size of the right side.
Error in poSTAR_14 (line 2)
F(1)=Hm_RI*x;
Error in fsolve_PO>@(x)fun(x,Hm_RI,at_RI,J) (line 202)
x = fsolve(@(x)fun(x,Hm_RI,at_RI,J),x0);
Error in fsolve (line 248)
fuser = feval(funfcn{3},x,varargin{:});
Error in fsolve_PO (line 202)
x = fsolve(@(x)fun(x,Hm_RI,at_RI,J),x0);
Caused by:
Failure in initial objective function evaluation. FSOLVE cannot continue.
  4 件のコメント
奥 刘
奥 刘 2021 年 11 月 11 日
@Jon Sorry I'm now away from my PC that run this matlab code, I will provide the data as soon as I get back to work. Really thanks for your help!
奥 刘
奥 刘 2021 年 11 月 12 日
@Jon Thanks for your help! I have solved this problem.

サインインしてコメントする。

採用された回答

Matt J
Matt J 2021 年 11 月 11 日
編集済み: Matt J 2021 年 11 月 11 日
function F = poSTAR_14(x,Hm_RI,at_RI,J)
F1=Hm_RI*x;
F2=at_RI*x-[1;0];
F3=abs(x(1:32,1)).^2+abs(x(33:64,1)).^2-ones(J,1); %The abs() seems unnecessary here
F=[F1(:);F2(:);F3(:)];
end
  4 件のコメント
奥 刘
奥 刘 2021 年 11 月 12 日
編集済み: 奥 刘 2021 年 11 月 12 日
After the correction, 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"?
奥 刘
奥 刘 2021 年 11 月 12 日
@Matt J Thanks! Now I know why I am wrong.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

タグ

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by