Changing step tolerance for lsqcurvefit

11 vues (au cours des 30 derniers jours)
Daniel Alejandro Diaz
Daniel Alejandro Diaz le 11 Avr 2023
Dear Community
I have been trying to change my step tolerance but I have been unsuccessful. Currently, I am using
options = optimoptions(options,'StepTolerance',1e-10);
But I keep getting this error:
Can someone please help me in getting this to work to match my data? I believe since my step is currently set to 1.0e-6 and since my Dab is smaller than this at 7.9e-8 it runs into an issue that it cant match
  2 commentaires
Torsten
Torsten le 11 Avr 2023
Modifié(e) : Torsten le 11 Avr 2023
Didn't you read my response to a previous question of yours ?
The end concentration of your model function is Co*Vp/Vl. If this value doesn't equal the asymptotic value of your measurement data, you won't be able to fit your data with the model function. In the case above, the end concentration of your model function is 0.0056 which is not consistent with your measurement data.

Connectez-vous pour commenter.

Réponse acceptée

dpb
dpb le 11 Avr 2023
opt=optimoptions('lsqcurvefit');
opt.StepTolerance=1E-8
opt =
lsqcurvefit options: Options used by current Algorithm ('trust-region-reflective'): (Other available algorithms: 'interior-point', 'levenberg-marquardt') Set properties: StepTolerance: 1.0000e-08 Default properties: Algorithm: 'trust-region-reflective' CheckGradients: 0 Display: 'final' FiniteDifferenceStepSize: 'sqrt(eps)' FiniteDifferenceType: 'forward' FunctionTolerance: 1.0000e-06 JacobianMultiplyFcn: [] MaxFunctionEvaluations: '100*numberOfVariables' MaxIterations: 400 OptimalityTolerance: 1.0000e-06 OutputFcn: [] PlotFcn: [] SpecifyObjectiveGradient: 0 SubproblemAlgorithm: 'factorization' TypicalX: 'ones(numberOfVariables,1)' UseParallel: 0 Show options not used by current Algorithm ('trust-region-reflective')
in your code above
...
Dab = lsqcurvefit(@f, x0, t, c) % fitting Dab to function(@f) defined below
% to data t & c starting at 0 by using x0
% and will be in units (cm^2/s)
options = optimoptions(options,'StepTolerance',1e-10);
...
it does no good to set the optimization options object after you've already called the optimizer/fitting function...
...
opt=optimoptions('lsqcurvefit'); % create default object for given fitter
opt=optimoptions(opt,'StepTolerance',1e-10); % set the step tolerance to something other than default
Dab = lsqcurvefit(@f, x0, t, c,[],[],opt)
% to data t & c starting at 0 by using x0
% and will be in units (cm^2/s)
...
  1 commentaire
Daniel Alejandro Diaz
Daniel Alejandro Diaz le 11 Avr 2023
Thank you! it works now!!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Manual Performance Optimization dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by