change deqam.m to avoid NaN