I am using MATLAB function lsqnonlin to get the optimal parameters for a system of ODE.
lsqnonlin by default gives an option to get the Jacobian.
Now, when I am trying to get the same parameters using fminsearch, I can't get the Jacobian by default.
I know that there are some fundamental differences between both optimizers, mainly because lsqnonlin uses n gradient-based method => the optimizer calculate the gradient at each iteration, which fminsearch does not.
But is there any function/trick in MATLAB to get the Jacobian after the last fminsearch iteration ?