This process involves two model files. One is used for optimization, and the other is for the final use after optimization. You must run the 'Main_ImperialistCompetitiveAlgorithm.m' file for optimization. You can modify the parameter optimization range by changing the [varmin] and [varmax] matrices in the 'Main_ImperialistCompetitiveAlgorithm.m' file. After obtaining the optimized PI controller parameters, you can input them into the 'dc_motor_speed_controller_final' model to observe the motor speed response. A signal generator acts as the reference speed profile, with three signals in total. The second signal is used for optimization purposes. If you need to modify the reference signal for optimization, you must also change the cost function. The [n] matrix and [input] matrix must be adjusted, and the indices will also change. Please refer to the cost function. The cost function consists of a set of metrics, including total integral error, settling time, rise time, and overshoot. Priorities are assigned to these parameters—for example, rise time and settling time are considered more critical than overshoot and error. If adjustments are needed, you must update the cost function accordingly.