A state observer for nonlinear dynamical systems