fixed matlab script