How to use fsolve to optimize and minimize given parameters

조회 수: 2 (최근 30일)
Mat Z
Mat Z 2022년 2월 14일
댓글: Mat Z 2022년 2월 14일
As part of an algorithm I am implementing (described here), I need to use MATLAB's fsolve function to solve the following:
Where fsolve must iterate t1, t2, tf, and the L2 norms of L, (1)H, and (2)H are provided by my inner loop embedded function (too complex to discuss in one question).
Currently I am implementing it as follows:
%% Call and solve inner loop using provided time parameters
fun = @(x) TFC_InnerLoop_PD(x, otherParameters);
x0 = [t1 t2 tf];
x = fsolve(fun, x0);
However, every time it ends with message "fsolve stopped because the relative size of the current step is less than the value of the step size tolerance and the vector of function values is near zero as measured by the value of the function tolerance." The vector returned by x is always exactly the same as my initial t1, t2, tf guess parameters. Have I misunderstood fsolve, or is the problem likely within my inner loop?
Many thanks.

채택된 답변

Matt J
Matt J 2022년 2월 14일
편집: Matt J 2022년 2월 14일
Whether the final point is the same as the initial point or not, the message is telling you that the final point does solve the equations. You can verify whether that's true by looking at the fval output,
[x,fval,exitflag] = fsolve(fun, x0);
or just by evaluating fun(x) yourself.
Since you obviously don't expect the initial point to be a solution, there probably is an issue in the equation funciton that you've provided.
  댓글 수: 1
Mat Z
Mat Z 2022년 2월 14일
Alright, that makes sense, thank you - I'll do some digging around in the function.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by