1. A method of determining a magnetic field vector, the method comprising: storing, for each of a plurality of sensor orientations, one or more calibration components; determining, for a sensor orientation not included in the plurality of sensor orientations, a magnetic field vector and a gravity vector; iteratively estimating, by a processor, one or more calibration coefficients based on the stored components, the determined magnetic field vector, and the determined gravity vector, wherein the calibration coefficients are updated during each of a plurality of iterations; and determining a sensor-orientation-independent magnetic field vector based on at least one of the calibration coefficients.