Dynamic bounds of the LSQCURVEFIT(FUN,X0,XDATA,YDATA,LB,UB)
Show older comments
I am trying to update my "LB" and "UB" constraints within the LSQCURVEFIT as it fits, dynamically, but I am not sure how to do that.
Is there any way to do so (for example by making them "global", or by using any other trick)?
4 Comments
Star Strider
on 13 Jul 2012
I doubt it's possible, and I don't understand why you'd want to. I suggest initially setting wide bounds on both, and run ‘lsqcurvefit’ as many times as necessary with the default options to see what parameter estimates best fit your data. Then constrain the parameters (perhaps to the bounds of ‘nlparci’ so set your output to be able to calculate them), set ‘MaxIter’ and ‘MaxFunEvals’ to 10000, ‘TolFun’ and ‘TolX’ to 1E-8, and let it run.
James
on 13 Jul 2012
Star Strider
on 13 Jul 2012
I believe ‘lsqcurvefit’ only looks at the bounds once, then uses them to calculate its Lagrange multipliers. The only way I can think of to get around this so you can change the bounds in the process of fitting your parameters is to set your ‘options’ structure to a very small number of iterations and function evaluations (perhaps 20), then put your call to ‘lsqcurvefit’ in a ‘for’ loop, updating your bounds at each iteration, and using the previous outputs of ‘lsqcurvefit’ (parameter estimates and anything else necessary) as inputs to the next iteration for as long as you need the loop to run.
Have fun!
Walter Roberson
on 14 Jul 2012
Please do not use "matlab" as a Tag. http://www.mathworks.co.uk/matlabcentral/answers/43073-a-guide-to-tags
Answers (0)
Categories
Find more on Nonlinear Least Squares (Curve Fitting) 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!