A new method is proposed to obtain accurate hydrodynamic coefficients of 3-DOF ship models. This method includes two parts: identification algorithm and identification input design. Firstly, the manoeuvring modeling group model of an underactuated ship is introduced. Secondly, the nonlinear model of the ship is converted into a linear form by using the X-swapping technique. An on-line identification law, which is introduced for identification under relaxed excitation conditions, is used to estimate the unknown hydrodynamic coefficients of the ship dynamic model. Thirdly, two Pseudo-Random Binary Sequence signals are chosen as the identification inputs to excite the rudder and the propeller, which can improve identification performance. Finally, a simulation example is put forward to demonstrate the effectiveness of the proposed identification method.