Fixing indexing and array initialization issues as MATLAB's array index starts at 1 while python's starts at 0