How to change the tolerance of optimization function lsqnonlin()?

7 Ansichten (letzte 30 Tage)
Sushant  Kumar
Sushant Kumar am 28 Mai 2013
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 Kommentar
Sushant  Kumar
Sushant Kumar am 28 Mai 2013
Also, i checked whether tolerance has changed or not using...
optimset('lsqnonlin')
but it displayed the default value of 'TolFun' only. Should i also change 'TolX'?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Alan Weiss
Alan Weiss am 28 Mai 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

Community Treasure Hunt

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

Start Hunting!

Translated by