How does MATLAB calculate the jacobian of a function that does not have an expression in lsqnonlin?

7 views (last 30 days)
I'm using Lsqnonlin to do curve fitting and get parameters.
A quick overveiw of the problem: I have a Numerical DiffEq solver (in the form of a mex file) that is operated through MATLAB, a function blackboxfunction(A,t, X). The DiffEq solver provides my 'model' data (from theory).
We perform experients with known experimental values 'A' and for a known time from 0 to t.
X are parameters that are unknown, but can be obtained by inverse fitting the 'model' data to the 'experimental' data. Both experimental and model data are plotted in the form of curves.
This is essentially a non-convex optimization problem: What are the parameters (X) such that the function @(X)blackboxfunction(A,t,X) - y_experimental(t) is minimized.
In other words - what parameters 'X' gets the experimental and model curves to overlap perfectly?
Now, during the optimization itself, I'm having some issues with the confidence intervals, but before I get into troubleshooting that I would like to know how MATLAB obtains estimates of the jacobian for such a function?
Does the jacobian depend on values of 'FiniteDifferenceStepSize' in optimoptions? How so?
My problem is that my confidence intervals are all over the place - some are too narrow (values outside the CIs give reasonable fits, visually) and some are too wide (values inside the CIs give reasonable fits). Any advice is welcome!

Answers (1)

Alan Weiss
Alan Weiss on 6 Jul 2020
It is possible that the examples Fit ODE, Problem-Based or Fit an Ordinary Differential Equation (ODE) would show you reasonable ways of accomplishing your goal. If you really want to know the underlying algorithms, look at Least Squares (Model Fitting) Algorithms.
Alan Weiss
MATLAB mathematical toolbox documentation


Find more on Systems of Nonlinear 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!