The purpose of Input Shaping is to filter out big changes (typically steps) in the reference signal of a closed-loop system which excite all the modes of the plant causing relevant snap overshoots and oscillations in the response.
The underlying working principle is to apply the step in subsequent portions with a proper amplitude and time instants so that the modes are excited in counter-phase (posicast) and the resulting oscillations are reduced as much as possible. In case of a plant with a known dynamics, the coefficients C and time instant T of the shaper are computed in literature by a pole-zeros analysis.
Genetic Algorithm is used here to train the shaper parameters accounting for plant uncertainties and even when no a priori knowledge is given about the dynamic. GA approach turn out to be extremely effective and is capable of improving the performances also in conditions when standard techniques are usually adopted.
The Shaper is designed as a state machine in order to be easily coded within embedded systems, e.g. through Real Time Embedded Coder.
The function implementing the GA optimization is in the M-file shaperScan: it tunes the shaper parameters for the plant given in the model Plant.mdl (a 3-modes plant is given as an example).