In a quadrupole mass spectrometer, the ions generated in the ion source are accelerated by a static electric field between the ion source and the detector. In the process, they fly through four parallel rod electrodes, which form a square (quadrupole) in the direction of flight of the ions. An alternating electric field is applied to the electrodes (homopolar on opposite electrodes), which can be modulated. The alternating field can be adjusted so that the ions are selected by mass / charge ratio, with the result that only ions of a defined mass can pass through the field to the detector.