Apparatus, comprising: a catheter having at least one electrode which is configured to be inserted into a chamber of a body organ of a patient; fluoroscopic equipment; and a processor, which is configured to: record at a sequence of times respective first sets of currents between the at least one electrode and a plurality of patches positioned on skin of the patient, while recording the first sets of currents, acquire x-ray images using the fluoroscopic equipment of the at least one electrode and the plurality of patches, and determine locations of the catheter from the images, analyze the x-ray images or the first sets of currents to identify phases in a respiration cycle of the patient; generate, for each image, a set of displacement vectors (D T) representative of the displacement of the at least one electrode from each of the plurality of patches; categorize each set of displacement vectors (D T) according to its corresponding phase in the respiration cycle; categorize each set of the first sets of currents according to its corresponding phase in the respiration cycle; derive matrices forming a relation between the locations and the respective first sets of currents based on the categorized first sets of currents and the sets of displacement vectors, each of the matrices being based on the corresponding phase in the respiration cycle, record subsequent sets of currents between the at least one electrode and the patches, and determine, based on the relations, subsequent locations of the catheter in response to the subsequent set of currents. a catheter having at least one electrode which is configured to be inserted into a chamber of a body organ of a patient; fluoroscopic equipment; and a processor, which is configured to: record at a sequence of times respective first sets of currents between the at least one electrode and a plurality of patches positioned on skin of the patient, while recording the first sets of currents, acquire x-ray images using the fluoroscopic equipment of the at least one electrode and the plurality of patches, and determine locations of the catheter from the images, analyze the x-ray images or the first sets of currents to identify phases in a respiration cycle of the patient; generate, for each image, a set of displacement vectors (D T) representative of the displacement of the at least one electrode from each of the plurality of patches; categorize each set of displacement vectors (D T) according to its corresponding phase in the respiration cycle; categorize each set of the first sets of currents according to its corresponding phase in the respiration cycle; derive matrices forming a relation between the locations and the respective first sets of currents based on the categorized first sets of currents and the sets of displacement vectors, each of the matrices being based on the corresponding phase in the respiration cycle, record subsequent sets of currents between the at least one electrode and the patches, and determine, based on the relations, subsequent locations of the catheter in response to the subsequent set of currents. record at a sequence of times respective first sets of currents between the at least one electrode and a plurality of patches positioned on skin of the patient, while recording the first sets of currents, acquire x-ray images using the fluoroscopic equipment of the at least one electrode and the plurality of patches, and determine locations of the catheter from the images, analyze the x-ray images or the first sets of currents to identify phases in a respiration cycle of the patient; generate, for each image, a set of displacement vectors (D T) representative of the displacement of the at least one electrode from each of the plurality of patches; categorize each set of displacement vectors (D T) according to its corresponding phase in the respiration cycle; categorize each set of the first sets of currents according to its corresponding phase in the respiration cycle; derive matrices forming a relation between the locations and the respective first sets of currents based on the categorized first sets of currents and the sets of displacement vectors, each of the matrices being based on the corresponding phase in the respiration cycle, record subsequent sets of currents between the at least one electrode and the patches, and determine, based on the relations, subsequent locations of the catheter in response to the subsequent set of currents.