The purpose of iterative PSO is to plan a flexible needle puncture path according to the requirements. The file fitnessfunc_3D_yuanxin_m is used to calculate the center of the circle after rotation through the D-H matrix to facilitate path planning. The center coordinates of each arc can be obtained by inputting the puncture radius r, the length of each arc corresponding to the combination of the center Angle u, and n. The pos_parameter_effect_itera file discusses the impact of parameters w, c1, c2 on PSO planned path length, calculation time, and path error. Change three parameters to get the result. File PSO_iterative injects the parameters obtained from the previous two files and runs the coordinates of target points and obstacle points to obtain a path of iterative particle swarm planning. r is the puncture radius, xt, yt, zt is the coordinate of the target point, and cob is the coordinate of the obstacle point. Changing these two values can change the path planning. The above files are all run in MATLAB.