Matlab Code for whitemesh