Described herein is an exhalation valve for a ventilator that controls gas flow through a patient exhalation line in response to a target pressure within the line. The valve controls gas flow by (i) providing both a high frequency signal and a low frequency signal through a coil positioned in a fixed magnetic field, (ii) determining a position of the coil by detecting the high frequency signal, and (iii) controlling a position of the coil by adjusting the low frequency signal.