In this paper, we present a calibration technique for controlling the magnetic field emitted by an antenna without measuring that magnetic field or the current through the antenna. Using a predictive algorithm and without adding hardware to perform test measurements, the system is able to determine the duty cycle of a class-D power amplifier with a deviance lower than 0.5%. between the simulated and predicted values. This technique is applied to a medical sensing application, thus the magnetic field is used to determine the position of a pill inside the digestive tract of a patient.