question regarding lsqcurvefit/lsqnonlin and upp/low jacobian values of zero

2 views (last 30 days)
Hi,
I am a little stumped with the lsqcurvefit and the jacobian output argument. I have a few hundred lines of code that gives a nice output and converges greatly with my 'ydata' comparative function. I have rearranged in a less ideal way (not easy to pass to students with those requirements) to use with lsqnonlin routine. I have also used the 'trust region reflective' and Levenberg-Marquardt options and still have the same problem.
The crux of the problem is in the Jacobian values returned which are two matrices of upper and lower bound fitting parameters (6 parameters spits out lower: [1x6 double] and upper: [1x6 double] sets of data). This two set data is also peculiar from what I expected and any detail on this would be useful, where as I read it, the uncertainty should simply be residualnorm/J(i) with i=1:6.
The main problem on top of only getting some funny bounds from what I should expect to be a simple numerical estimation of the gradient of the functional parameter space is that I only get 0. Yes, exactly 0 which is very bizarre and means something is definitely wrong.
My input into the main program space is
>>[x,resnorm,residual,exitflag,output,jacobian] = lsqcurvefit(@forfittingf1,[0.1 10 0.7 2 4 1],[0:0.2:20],f1,[-Inf -Inf -Inf -Inf -Inf -Inf],[Inf Inf Inf Inf Inf Inf],optimset('TolFun',1e-20))
output at end just has
output =
firstorderopt: 131.2346e-015
iterations: 18.0000e+000
funcCount: 133.0000e+000
cgiterations: 0.0000e+000
algorithm: 'large-scale: trust-region reflective Newton'
message: [1x417 char]
jacobian =
lower: [6x1 double]
upper: [6x1 double]
where I also (as already mentioned) tried the LM method in the Algorithm setting for lb,ub as [],[]
where I have used f1 as the raw data file (loaded .mat file into a vector) and xdata can really be anything including '1' to get the same convergence. I can change lb,ub to be [],[] or even [any real numbers],[any real numbers]. I still get the same .mat with 6 elements of zero value for the upper-lower jacobian.
Does anyone know why it just gives me zeros (noise and a few added bumps are in there so it cannot be a perfect fit. I would really like to give uncertainty estimates!!!
-Nate

Answers (0)

Community Treasure Hunt

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

Start Hunting!