Draft port of dispersion_check.m