The electrical motor steady-state equation is
R: resistance of the coil
Motor torque
From the equations above, with the addition of a square friction-air drag term, the dynamics of the train can be described from the equations below
where,
Cost function
The theoretical optimal solution is
Computationally, the open-loop solution is
For
If the initial state was to mildly change, for example x(0) = [0.4, 0.6]
The system develops a steady-state error. In order to mitigate that error, we will introduce a feedback correction term (closed-loop solution)
After solving the Riccati equation
By substituting