Matlab codes for the Rouwenhorst method