In this paper, the behavior of the magnetic swimmers has been simulated in the presence of an external magnetic field. The studied system is formed of spherical self-propelled particles that have magnetic properties and are suspended in a box. We have applied a homogeneous magnetic field with circular symmetry. The particle-toparticle, particle-to-wall, and bipolar-bipolar interactions have been ignored. The motion of particles has been described by the Langevin equation, and the Fokker-Planck equation has been used for the expression of the evolution of the probability density distribution function. In the steady-state, solving these equations shows the collective behavior of these magnetic particles. In the absence of an external magnetic field, these particles are smoothly distributed in the box. The motion of particles has been controlled by an external magnetic field. Applying an externally homogeneous magnetic field, these particles are concentrated at boundaries. If the magnetic field is an exponential function of distance, particles will collect in the middle of the box. This type of research has applications in targeted drug delivery to damaged tissues and the separation of magnetic particles.