added minimize and optimize to MATLAB wrapper