Matlab program compensates for dispersion