Measuring the Hessian matrix for lsqnonlin

3 views (last 30 days)
SM
SM on 27 Jul 2021
Answered: Nipun on 4 Jun 2024
Hello
I am optimising a multiobjective function using the lsqnonlin function with the trust-region reflective algorithm.
I was wondering how I can get the hessian matrix as an output?
Is it possible to calculate it using the Jacobian matrix at the optimum solution that lsnqnonlin provides?
Thanks

Answers (1)

Nipun
Nipun on 4 Jun 2024
Hi SM,
I understand that you are optimizing a multiobjective function using the lsqnonlin function with the trust-region reflective algorithm and are interested in obtaining the Hessian matrix at the optimum solution.
It is possible to estimate the Hessian from the Jacobian matrix at the optimum, especially when using the trust-region reflective algorithm.
Here is one way to calculate this approximation in MATLAB after running lsqnonlin:
% Assuming 'fun' is your function and 'x0' is your initial guess
options = optimoptions('lsqnonlin', 'Algorithm', 'trust-region-reflective', 'Jacobian','on', 'Display','final');
[x,resnorm,residual,exitflag,output,lambda,jacobian] = lsqnonlin(fun,x0,[],[],options);
% Approximating the Hessian from the Jacobian
Hessian_approx = jacobian'*jacobian;
This approach gives you an approximation of the Hessian based on the Jacobian provided by lsqnonlin. Please note that this is a simplification and may not capture the full curvature of your objective function, especially if the residuals are significantly non-linear in the region of interest.
Refer to the following MathWorks documentation on "lsqnonlin" function in MATLAB:
Hope this helps.
Regards,
Nipun

Categories

Find more on Numerical Integration and Differential Equations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!