Can I use Anonymous Function to pass additional parameters to the objective function in Genetic Algorithm of Global Optimization Toolbox??

3 views (last 30 days)
For Genetic Algorithm function, ga, of Global Optimization Toolbox, can I use Anonymous Function to pass additional parameters to the objective function (and constraint function) as we do in functions of Optimization Toolbox?
For example, Example 2 in the document for fminsearch is as follows:
Can I use the same way to pass additional parameters to the objective function of ga?
I read this post , but it's written 5 years ago, I'm not sure if it is still precise in recent versions. If it is, please tell me. If the way in the above example is now supported, please tell me too.
PS: Please note that ga is in Global Optimization Toolbox, but fminsearch is in Optimization Toolbox. The two toolbox are different.
Thanks for your answer.

Accepted Answer

Alan Weiss
Alan Weiss on 1 Jul 2014
Yes, this method of passing additional parameters works just fine. It is a valid MATLAB syntax, so it does not matter which toolbox you are using.
Alan Weiss
MATLAB mathematical toolbox documentation

More Answers (0)

Community Treasure Hunt

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

Start Hunting!