Problem using lsqnonlin with nlparci toolbox
Show older comments
I have a problem when calculating the confidence intervals using lsqnonlin and nlparci toolbox.
I wanted to calculate the CI using the Jacobian, however, I am getting the following error: Error using nlparci (line 93) The size of J does not match the sizes of BETA and RESID. I am fitting 6 parameters.
Here is the syntax of the fitting function and of the calculation of the CI.
[par_out, residual,jacobian] = lsqnonlin(@eq_2D3D1TR_set, MAT1,zeros(1,i),MAT2, options, tau_range, g_in_range,MAT3,FIX);
ci = nlparci(par_out, residual, 'jacobian', jacobian);
@eq_2D3D1TR_set is the fitting method
MAT1 are the starting points
zeros(1,i) and MAT2 are the lower and upper bounds
options contain different options of the fitting: options=optimset('Display', 'final','LargeScale', 'Off', 'DiffMaxChange', 0.1, 'DiffMinChange', 0.00001,'TolFun', 1e-100, 'TolX', 0.001, 'MaxFunEvals', 5000, 'MaxIter', 1000);
tau_range, g_in_range are the input data with the selected range
FIX contains information about which of the parameters are fixed during the fitting (the GUI provides this information)
Currently I am fitting with all of the 6 parameters non-fixed.
Truly, when I have a look at the computed Jacobian and residual, then the Jacobian has only 1 column (instead of 6 since I have 6 parameters) and the residual contains only 1 number, what seems also not OK.
Accepted Answer
More Answers (0)
Categories
Find more on Get Started with Curve Fitting Toolbox 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!