You can use Optimization Toolbox and write cost functions by hand. Basically, each cost function must:
- Assign a combination of parameters
- Simulate the model using the sim function
- Collect outputs
- Use these outputs to evaluate a cost function
Alternatively, you can further add on the Simulink Design Optimization (SDO) tool which gives you nice user interfaces for just this kind of problem. It can make things easier if you have access (or can get access) to that product.
It's not easy to find an example using Simulink and Optimization Toolbox because the recommendation is that you purchase SDO when working with Simulink models. I did find this old example ... I immediately see some poor MATLAB practices like "assignin" and "evalin" functions, but it might still be a good starting point if you can't get access to SDO.
- Sebastian