implemented the matrix formulation of the dispersion relation