Automatic lane-changing is a complex and critical task for autonomous vehicle control. Existing researches on autonomous vehicle technology mainly focus on avoiding obstacles; however, few studies have accounted for dynamic lane changing based on some certain assumptions, such as the lane-changing speed is constant or the terminal state is known in advance. In this study, a typical lane-changing scenario is developed with the consideration of preceding and lagging vehicles on the road. Based on the local trajectory generated by the global positioning system, a path planning model and a speed planning model are respectively established through the cubic polynomial interpolation. To guarantee the driving safety, passenger comfort and vehicle efficiency, a comprehensive trajectory optimization function is proposed according to the path planning model and speed planning model. In addition, a dynamic decoupling model is established to solve the problems of real-time application to provide viable solutions. The simulations and real vehicle validations are conducted, and the results highlight that the proposed method can generate a satisfactory lane-changing trajectory for automatic lane-changing actions. Index Terms-Autonomous vehicle, dynamic lane-changing, trajectory planning, real-time optimization, discrete global trajectory NOMENCLATURE A. ACRONYMS ADAS advanced driving assistant systems PFP potential field projection method RRT rapidly exploring random tree TP preceding vehicle on the target lane TL lagging vehicle on the target lane P preceding vehicle on the initial lane E the ego vehicle GPS global positioning system NGSIM next generation simulation SLC the static lane-changing DOLC dynamic optimized lane-changing