Respiratory phase detection and delay determination for breath-by-breath analysis.