How to change the tolerance of optimization function lsqnonlin()?
Show older comments
I tried changing the tolerance like this....
options = optimset('TolFun',1e-8);
[N,resnorm] = lsqnonlin(@myfunction5,n,[],[],options);
definition of myfunction5....
function r5 = myfunction5(N) global f1 f1 = 999000; r = zeros(10000,1); f = zeros(10000,1); for p = 1:10000 r(p,1) = 5 * sin(2*3.14*f1*(p/(10000000))+0.3); end for q1 = 1:10000 f(q1,1) = N(1) * sin((2*3.14*N(2)*(q1/10000000)) + N(3)); end r5 = r-f; end
But it is displaying this message and the value of N hence achieved is far from my requirement...
Local minimum possible.
lsqnonlin stopped because the final change in the sum of squares relative to its initial value is less than the selected value of the function tolerance.
How to set this up?
1 Comment
Sushant Kumar
on 28 May 2013
Answers (1)
Alan Weiss
on 28 May 2013
The exit message tells you that lsqnonlin used your TolFun:
lsqnonlin stopped because the final change in the sum of squares relative to its initial value is less than
the selected value
of the function tolerance.
For documentation on improving your results (which might be fine, the exit message only means that the first-order optimality is not all that small), see Local Minimum Possible.
Alan Weiss
MATLAB mathematical toolbox documentation
Categories
Find more on Choose a Solver 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!