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!