Using neural networks to identify a function in the dynamic equation brings about additional difficulties which are not generic in the other function approximation problems. First, training samples can not be arbitrarily chosen due to hard nonlinearity, so are apt to be nonuniform over the region of interest. Second, the system may become unstable while attempting to obtain the samples. This paper deals with these problems in continuous-time and discrete-time system, and suggests effective solutions which provide stability and uniform sampling by the virtue of robust control theory and heuristic algorithms.