The present invention relates to a respiratory apparatus, comprising a flow detecting device to sense respiration and generate an inspiratory wave pattern, and a controller coupled to the flow detecting device, the controller configured to decompose the inspiratory wave pattern into a matrix pair of basis vectors that are orthogonal, fit the basis vectors to the inspiratory waveform pattern, determine factors associated with the basis vectors from the fitting, and identify a presence of a flow limited shape in the inspiratory wave pattern based on a function of the factors, whereby the flow limited shape indicative of an M shape may be detected.