Matlab's code.