A system for mapping a magnetic field in a volume of interest, the system comprising: a magnetic field transmitter, generating a magnetic field in said volume of interest; at least one freestanding magnetic field detector, operative to freely move within said volume of interest, said at least one freestanding magnetic field detector acquiring measurements of the flux of said magnetic field at a plurality of poses (122 1 -122 N); an optical tracking system, for measuring information related to the pose of said freestanding magnetic field detector for at least a portion of said plurality poses (122 1 -122 N); and a processor, coupled with said magnetic field detector and with said optical tracking system, said processor determining pose related information respective of each of at least a portion of said measurements of the flux of said magnetic field, according to said information related to the pose of said freestanding magnetic field detector at said at least a portion of said plurality of poses (122 1 -122 N), characterized in that said processor is configured to estimate the entire set of parameters of a magnetic field model template according to said magnetic field flux measurements and the respective pose related information of said magnetic field flux measurements, said processor incorporating said entire set of parameters into said magnetic field model template, thereby determining said magnetic field model, wherein, said entire set of parameters includes the coefficients of said magnetic field model, the order of said magnetic field model, the number of the centers of expansion and the locations of the centers of expansion of said magnetic field model, and wherein, said centers of expansion of said magnetic field model relate to at least one magnetic field generator. a magnetic field transmitter, generating a magnetic field in said volume of interest; at least one freestanding magnetic field detector, operative to freely move within said volume of interest, said at least one freestanding magnetic field detector acquiring measurements of the flux of said magnetic field at a plurality of poses (122 1 -122 N); an optical tracking system, for measuring information related to the pose of said freestanding magnetic field detector for at least a portion of said plurality poses (122 1 -122 N); and a processor, coupled with said magnetic field detector and with said optical tracking system, said processor determining pose related information respective of each of at least a portion of said measurements of the flux of said magnetic field, according to said information related to the pose of said freestanding magnetic field detector at said at least a portion of said plurality of poses (122 1 -122 N), characterized in that said processor is configured to estimate the entire set of parameters of a magnetic field model template according to said magnetic field flux measurements and the respective pose related information of said magnetic field flux measurements, said processor incorporating said entire set of parameters into said magnetic field model template, thereby determining said magnetic field model, wherein, said entire set of parameters includes the coefficients of said magnetic field model, the order of said magnetic field model, the number of the centers of expansion and the locations of the centers of expansion of said magnetic field model, and wherein, said centers of expansion of said magnetic field model relate to at least one magnetic field generator.