Assessment of airway function during assisted ventilation