Some custom MATLAB functions.