Using derivatives function, diff and GA toolbox

3 visualizaciones (últimos 30 días)
Sepideh Alimohamamdi
Sepideh Alimohamamdi el 1 de Sept. de 2020
Comentada: Sepideh Alimohamamdi el 2 de Sept. de 2020
Hi,
I wrote a code using diff function to model some parameters. Now, I need to adjust some parameters with GA Matlab Toolbox. The parameters that I am aiming to optimize, have been used in the diff function, as well.
Is that work? I mean, can I optimize parameters that is used in the diff function? If yes, useing diff may decrease the spead of calculation? Is it recommneded to apply analytican deriviative instead of diff approximation?
Tnx

Respuesta aceptada

Alan Weiss
Alan Weiss el 1 de Sept. de 2020
You don't show any code, so my answer might be irrelevant.
Are you using diff as a symbolic derivative or as a standard MATLAB finite difference? If you are using a symbolic derivative, then ga does not apply until you convert the symbolic function to a standard MATLAB function using, for example, matlabFunction. See Symbolic Math Toolbox Calculates Gradients and Hessians.
But this brings up a more important point. If your problem is smooth, then don't use ga. Instead, use an appropriate Optimization Toolbox solver such as fmincon. Or for a global solution instead of a local solution, use MultiStart. I assume that your problem is smooth because you talk about analytic derivatives.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
  3 comentarios
Alan Weiss
Alan Weiss el 1 de Sept. de 2020
It appears the you are trying to use a Newton step to find the best fitting parameters for data. I think that you should use the solvers designed for this, lsqcurvefit or lsqnonlin to solve your problem, instead of ga. If you can supply analytic derivatives for your objective function, you can indicate so using the SpecifyObjectiveGradient option.
Alan Weiss
MATLAB mathematical toolbox documentation
Sepideh Alimohamamdi
Sepideh Alimohamamdi el 2 de Sept. de 2020
Thnaks for your answer.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Solver Outputs and Iterative Display en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by