An ablation apparatus, comprising: a flexible catheter adapted for insertion into a heart of a living subject and having a distally disposed ablation electrode to be brought into contact with a target tissue in the heart; an ablator, configured to apply a dosage of energy to the target tissue to ablate the target tissue; an impedance measuring subsystem, comprising a body surface electrode to be attached to the subject, having first circuitry for passing an electrical current between the body surface electrode and the ablation electrode and second circuitry for iteratively determining an impedance phase of the electrical current; a processor, linked to the impedance measuring subsystem, operative to perform the steps of: memorizing a designation of a contact state between the ablation electrode and a wall of the heart as one of an in-contact state and an out-of-contact state; making at least three determinations of an impedance phase angle of the electrical current; identifying a maximum phase angle and a minimum phase angle among the determinations; defining a binary classifier as a value that is intermediate the minimum phase angle and the maximum phase angle; when the designation of the contact state is the in-contact state, changing the designation to the out-of-contact state when another of the determinations is less than the binary classifier by at least a first hysteresis factor; when the designation of the contact state is the out-of-contact state, changing the designation to the in-contact state when the other of the determinations is greater than the binary classifier by at least a second hysteresis factor; and a monitor linked to the processor, which is operative to display a visual indication of the designation of the contact state of the ablation electrode during operation of the ablator. a flexible catheter adapted for insertion into a heart of a living subject and having a distally disposed ablation electrode to be brought into contact with a target tissue in the heart; an ablator, configured to apply a dosage of energy to the target tissue to ablate the target tissue; an impedance measuring subsystem, comprising a body surface electrode to be attached to the subject, having first circuitry for passing an electrical current between the body surface electrode and the ablation electrode and second circuitry for iteratively determining an impedance phase of the electrical current; a processor, linked to the impedance measuring subsystem, operative to perform the steps of: memorizing a designation of a contact state between the ablation electrode and a wall of the heart as one of an in-contact state and an out-of-contact state; making at least three determinations of an impedance phase angle of the electrical current; identifying a maximum phase angle and a minimum phase angle among the determinations; defining a binary classifier as a value that is intermediate the minimum phase angle and the maximum phase angle; when the designation of the contact state is the in-contact state, changing the designation to the out-of-contact state when another of the determinations is less than the binary classifier by at least a first hysteresis factor; when the designation of the contact state is the out-of-contact state, changing the designation to the in-contact state when the other of the determinations is greater than the binary classifier by at least a second hysteresis factor; and a monitor linked to the processor, which is operative to display a visual indication of the designation of the contact state of the ablation electrode during operation of the ablator. memorizing a designation of a contact state between the ablation electrode and a wall of the heart as one of an in-contact state and an out-of-contact state; making at least three determinations of an impedance phase angle of the electrical current; identifying a maximum phase angle and a minimum phase angle among the determinations; defining a binary classifier as a value that is intermediate the minimum phase angle and the maximum phase angle; when the designation of the contact state is the in-contact state, changing the designation to the out-of-contact state when another of the determinations is less than the binary classifier by at least a first hysteresis factor; when the designation of the contact state is the out-of-contact state, changing the designation to the in-contact state when the other of the determinations is greater than the binary classifier by at least a second hysteresis factor; and a monitor linked to the processor, which is operative to display a visual indication of the designation of the contact state of the ablation electrode during operation of the ablator.