你把matlab的矩阵用python的numpy包包就行。
import numpy as np a = np.zeros([n,n]) for i in range(1,n+1): a[i-1,:] = #类似这种i-1就是指的矩阵a第i行