How to avoid unrecognized option names using optimget

9 Ansichten (letzte 30 Tage)
Luca
Luca am 31 Okt. 2024
Kommentiert: Luca am 31 Okt. 2024
I am using lsqcurvefit and receiving errors related to the function lsqncommon. I did not have these errors in the past, so this may be due to changes with more recent versions of Matlab. How can I edit the lines below to avoid these errors? Thank you.
Error 1. "Unrecognized option name 'InitDamping'. See OPTIMSET for possibilities."
Relevant lines of lsqncommon:
algorithm = optimget(options,'Algorithm',defaultopt,optimgetFlag);
initDamping = optimget(options,'InitDamping',defaultopt,optimgetFlag);
if ~iscell(algorithm)
initLMparam = initDamping;
else
initLMparam = algorithm{2}; % Initial Levenberg-Marquardt parameter
algorithm = algorithm{1}; % Algorithm string
end
Error 2. "Unrecognized option name 'ProblemdefOptions'. See OPTIMSET for possibilities."
Relevant lines of lsqncommon:
ProblemdefOptions = optimget(options, 'ProblemdefOptions',defaultopt,optimgetFlag);
FromEqnSolve = false;
if ~isempty(ProblemdefOptions) && isfield(ProblemdefOptions, 'FromEqnSolve')
FromEqnSolve = ProblemdefOptions.FromEqnSolve;
end
  8 Kommentare
Matt J
Matt J am 31 Okt. 2024
Bearbeitet: Matt J am 31 Okt. 2024
The lsqncommon routine was rewritten between the two versions, and no longer has the problematic call.
I can't find any documentation of that. I don't think we've even identified what the "problematic call" is, because we haven't seen the OP's actual code.
When I run the hypothetical code that I proposed in R2024a, it still runs fine.
Luca
Luca am 31 Okt. 2024
Thank you both. Although I am using R2024a, that particular code still uses an older (2016-2019) version of lsqcurvefit. This older version of lsqcurvefit gives me the same error when I try the simplified code above:
Error using optimget
Unrecognized option name 'InitDamping'. See OPTIMSET for possibilities.
Error in lsqncommon
initDamping = optimget(options,'InitDamping',defaultopt,optimgetFlag);
Error in lsqcurvefit
lsqncommon(funfcn,xCurrent,lb,ub,options,defaultopt,allDefaultOpts,caller,...
The current version of lsqcurvefit does not give me these errors, and the simplified code above runs just fine.
Something has changed in lsqcurvefit between 2016-2019 and now that is causing this different behavior.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Matt J
Matt J am 31 Okt. 2024
Bearbeitet: Matt J am 31 Okt. 2024
Although I am using R2024a, that particular code still uses an older (2016-2019) version of lsqcurvefit.
If so, problem solved. Use the version of lsqcurvefit that accompanies R2024a. It is obviously dangerous and unpredictable to mix Mathworks-authored files from different Matlab releases.

Weitere Antworten (0)

Produkte


Version

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by