Compensation-device for a magnetic field