Updated waveray.m