Functions that are useful to me. Matlab version 2011a