Using derivatives function, diff and GA toolbox

조회 수: 5 (최근 30일)
Sepideh Alimohamamdi
Sepideh Alimohamamdi 2020년 9월 1일
댓글: Sepideh Alimohamamdi 2020년 9월 2일
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

채택된 답변

Alan Weiss
Alan Weiss 2020년 9월 1일
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
Alan Weiss
Alan Weiss 2020년 9월 1일
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 2020년 9월 2일
Thnaks for your answer.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by