You have rand() in your code. Of course you are going to get different answers each time you run it.
The work-around is to re-seed the random number generator to a constant value before running the code. The easiest method of reseeding the random number generator depends upon your MATLAB version.