Dynamical analysis of an optical rocking ratchet: Theory and experiment