IRFunctionCurve and resulting objective function value

1 visualización (últimos 30 días)
Torsten Beer
Torsten Beer el 18 de Oct. de 2022
Respondida: Ravi el 29 de Dic. de 2023
Hello, I'm using the class IRFunctionCurve out of financial toolbox. With the method fitFunction I calibrate an IRCurve to existing bond data. I'm interested in the result value of the optimisation (either lsqnonlin or fmincon). Both optimisation functions would provide the resulting value of the objective function but the value is not taken into a variable (see second output:
Lines 566-570 of IRFunctionCurve.m
if strcmpi(FitOptions.OptimFunction,'lsqnonlin')
[Params,~,~,exitflag] = lsqnonlin(@costfun,x0,lb,ub,options);
else
[Params,~,exitflag] = fmincon(@(x) norm(costfun(x)),x0,A,b,[],[],lb,ub,[],options);
end
Is it possible to get the objective function value in another way? If not, could this be added in a later release?
Many thanks
  3 comentarios
Torsten Beer
Torsten Beer el 18 de Oct. de 2022
I agree, but the code was from Financial Toolbox/IRFunctionCurve, so this would need to be implemented by Mathworks, Otherwise I would have to duplicate the function.
Torsten
Torsten el 18 de Oct. de 2022
Maybe you have different releases for MATLAB basic package and the Financial Toolbox ?

Iniciar sesión para comentar.

Respuestas (1)

Ravi
Ravi el 29 de Dic. de 2023
Hi Torsten Beer,
You can use the following function syntax for “lsqnolinto obtain the value of the optimization function.
[x,resnorm,residual,exitflag,output] = lsqnonlin(___)
Here, “resnorm” gives the value of the residual sum of squares at the solution “x”, and “residual” gives the residual “costfunction(x), the optimization function value at the solution.
For “fmincon” function, you can use the following simple syntax.
[x,fval] = fmincon(___)
Here, “fvalcontains the value of the objective function at the solution “x”.
To learn more about “lsqnolin” and “fmincon” functions, please refer to the following links.
Thanks,
Ravi

Categorías

Más información sobre Solver Outputs and Iterative Display en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by