MLAPP Algorithm in Matlab