calculate_rms function

Calculate sample-to-sample root mean square distance (RMS) of a data segment