python & matlab code