Prev: differential equation
Next: C6416 - Missing Reply
From: Abu Bakar Md on 6 Aug 2010 11:24 Dear All, I am using lsqcurvefit with the following option for one of my dataset: options=optimset('Display','off','LargeScale','off','LevenbergMarquardt','on','Tolfun',1e-12,'TolX',1e-10); In version 7.7.0.471 (R2008b), I found that for the dataset, lsqcurvefit returns EXIT_FLAG=-3 which is not documented in the matlab help file. It has -1, -2 and -4 EXIT_FLAG and there is no definition for returned EXIT_FLAG=-3. If I try the same code and data on version 7.4.0.336 (R2007a) , I found that the return flag is positive. From inspection of the file levenbergMarquardt.m, I found that the EXIT_FLAG=-3 is produced by comparing with a variable called lambda and every while loop it is multiplied by 10 and compared to be smaller than a hard-coded value 1e16 - that allows a looping of only 18 times. I think this is the reason why the algorithm is failing. Does anybody know what's wrong going on there? I would like to thank everybody in advance and best regards Asad
From: Alan Weiss on 6 Aug 2010 12:49 On 8/6/2010 11:24 AM, Abu Bakar Md wrote: > Dear All, > I am using lsqcurvefit with the following option for one of my dataset: > > options=optimset('Display','off','LargeScale','off','LevenbergMarquardt','on','Tolfun',1e-12,'TolX',1e-10); > > > In version 7.7.0.471 (R2008b), I found that for the dataset, lsqcurvefit > returns EXIT_FLAG=-3 which is not documented in the matlab help file. It > has -1, -2 and -4 EXIT_FLAG and there is no definition for returned > EXIT_FLAG=-3. If I try the same code and data on version 7.4.0.336 > (R2007a) , I found that the return flag is positive. > From inspection of the file levenbergMarquardt.m, I found that the > EXIT_FLAG=-3 is produced by comparing with a variable called lambda and > every while loop it is multiplied by 10 and compared to be smaller than > a hard-coded value 1e16 - that allows a looping of only 18 times. I > think this is the reason why the algorithm is failing. > Does anybody know what's wrong going on there? > I would like to thank everybody in advance and best regards > Asad Sorry you ran into this bug in the documentation. If you enter help lsqcurvefit in the R2008b MATLAB command line, you see the following explanation of exit flag -3: -3 Regularization parameter too large (Levenberg-Marquardt). This can happen when your problem is poorly scaled. You can try the following options setting: options=optimset('Display','off','Algorithm','levenberg-marquardt','ScaleProblem','Jacobian','TolFun',1e-12,'TolX',1e-10); You can also try using the default trust-region-reflective algorithm. Good luck, Alan Weiss MATLAB mathematical toolbox documentation
|
Pages: 1 Prev: differential equation Next: C6416 - Missing Reply |