MATLAB Answers

Global Optimization for a Simulink Model

19 views (last 30 days)
Hi,
The problem
I need to optimize 10 paramters of a simulink model within some lower/upper bounds so that the mean error between real and simulated ouput is minimized. The problem has multiple optima.
Question
How could I apply the a genetic algorithm or a surrogate optimization as part of the Simulink Design Optimization application? if not, how to convert a Simulink design optimization problem into an objective function that I can pass to the above mentioned functions?
Thank you for your help,
Miguel

  0 Comments

Sign in to comment.

Accepted Answer

Alan Weiss
Alan Weiss on 11 Jan 2021
Edited: Alan Weiss on 11 Jan 2021
You probably want to minimize the mean squared error. For an example, see lsqnonlin with a Simulink® Model. You can change the solver from lsqnonlin to ga or surrogateopt easily, by reformulating the objective function as in Nonlinear Data-Fitting.
One word of caution: you probably cannot optimize a Simulink model in parallel by setting the UseParallel option. Please try the optimization in serial.
Alan Weiss
MATLAB mathematical toolbox documentation

  3 Comments

Miguel Esteras
Miguel Esteras on 18 Jan 2021
Thanks Alan, that worked as described in the examples.
What would be the problem of optimizing in parallel in this case?
Alan Weiss
Alan Weiss on 18 Jan 2021
To call Simulink in parallel, the underlying mechanism should be parsim. However, ga and surrogateopt do not use parsim. Instead, they use parfor or some other mechanism. I believe that Simulink Design Optimization does use the correct mechanism, but I do not know that product so cannot give you advice relating to it.
Alan Weiss
MATLAB mathematical toolbox documentation
Miguel Esteras
Miguel Esteras on 18 Jan 2021
Right,... for what I have been told by a local Simulink support staff, Simulink Design Optimization might not be able to use global optimization algorithms such as ga or surrogated out of the box.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!