The problem of designing and implementing optimal controllers for a class of affine nonlinear systems is considered. Nonlinear optimal control problem generally leads to the difficulty of solving nonlinear Hamilton-Jacobi-Bellman (HJB) equation, in order to avoid the HJB problem, State-dependent Riccati equation (SDRE) method is adopted firstly to design nonlinear optimal controller. And then, a method of choosing weighting matrices of state-dependent is proposed. In order to avoid solving algebraic Riccati equations for P(x) at each sampling step, an Improved Newton Method (INM) is adopted secondly for implementation of SDRE controller, which can get P(x) by its own iteration, therefore computational and storage burden can be reduced for complex and high-order systems. Finally, simulation is carried out by a permanent magnet synchronous motor (PMSM) model to evidence the effectiveness of the method proposed in this paper.