From nonlinear to hamiltonian via feedback