Optimal Velocity Function Minimizing Dissipated Energy Considering All Friction in a Position Control System