matlab implementation of fastphase with EM