In a respiratory apparatus for treatment of sleep apnea and other disorders associatedwith an obstruction of a patient's airway and which uses an airflow signal,an obstruction index is generated which detects the flattening of the inspiratoryportion of the airflow. The flattening index serves as an obstruction index usedto differentiate normal and obstructed breathing. The obstruction index isbased upon comparison of values of airflow in different sectors of the inspiratorypeak of the wave function and is particularly suitable for distinguishing M shapedor square shaped respiratory patters indicative of partially obstructed airways.