How to use fsolve to optimize and minimize given parameters

2 Ansichten (letzte 30 Tage)
Mat Z
Mat Z am 14 Feb. 2022
Kommentiert: Mat Z am 14 Feb. 2022
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.

Akzeptierte Antwort

Matt J
Matt J am 14 Feb. 2022
Bearbeitet: Matt J am 14 Feb. 2022
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 Kommentar
Mat Z
Mat Z am 14 Feb. 2022
Alright, that makes sense, thank you - I'll do some digging around in the function.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by