Perform optimization-based control system design in Simulink®, or if you have Control System Toolbox™ implement it in the Control System Designer app.
In Simulink, you can optimize controller parameters, such as PID gains, in your model to meet time-domain and frequency-domain design requirements. Optimize parameter in the Response Optimization tool, or the command line. For example, see Design Optimization to Meet Step Response Requirements (GUI).
In Control System Designer app, you can design control systems for LTI models by optimizing controller parameters. See, When to Use Optimization-Based Linear Control Design.