matlab code for psychology study