The high-frequency resonant cavity is affected by factors such as beam load, gravity and heat loss caused by cavity deformation during the actual operation of the medical cyclotron. The resonant frequency will shift to a certain extent, resulting in the high-frequency operation frequency varying with the resonant frequency of the resonator cavity. In order to meet the requirements for isochronous acceleration, the magnetic field strength should also be changed correspondingly when the high-frequency operation frequency changes, that is, the magnitude of the magnet current needs changing accordingly, so that the particle cyclotron frequency matches the high-frequency resonant frequency to overcome the sliding phase. Firstly, the static magnetic field model is established by finite element simulation software to simulate the average magnetic field of cyclotron under different magnet currents. Then the relationship between the magnetic field and the resonant frequency is theoretically analyzed. Finally, the relationship between the magnet current and the resonant frequency is obtained when the magnet current varies in a small interval. According to the optimal magnet current corresponding to different resonance frequencies, the automatic frequency tracking of magnet current is completed. In the case of ensuring the maximum carbon film beam, the optimal magnet current corresponding to different resonance frequencies is obtained, which makes the theory validated. According to the relationship, the magnet current is automatically adjusted, which overcomes the slip phase and ensures the stable output of the Faraday beam. The method enables the magnet current to be quickly and accurately find and track the cavity frequency, overcomes the slip phase caused by the frequency offset, and completes the stable output of the beam.