A control unit for a ventilator is arranged to receive, from each of a number of electrode pairs on an esophageal catheter a bioelectric signal having an ECG component. The control unit has a calculating unit that determines the ECG component of each of the bioelectric signals and a position unit that determines the position of the catheter in relation to the patients diaphragm based on a comparison the amplitudes of ECG components of the bioelectric signals.