MATLAB implementation of the phase estimation described by Van Someren and Nagtegaal E (2007). http://dx.doi.org/10.1016/j.sleep.2007.03.012.