Adaptive-phase k-means algorithm for waveform classification