Inverse design of EBG waveguides through scattering matrices