In a respiratory apparatus for treatment of sleep apnea and other disorders associated with an obstruction of a patient's airway and which uses an airflow signal, an obstruction index is generated which detects the flattening of the inspiratory portion of the airflow. The obstruction index is used to differentiate normal and obstructed breathing. The obstruction index is based upon different weighting factors applied to sections of the airflow signal thereby improving sensitivity to various types of respiration obstructions.