jeudi 21 octobre 2021

Convert matlab to Numpy

I want to convert Matlab to Python:

a = randn(20,20);
b = randsample(100, 30, false);
c = 2.5*mean(mean(abs(a)));
d = 2*c*rand(20,10)-c;
e = d(a);

This is what I did:

a = np.random.randn(20,20)
b = np.random.randint(100, size=(100, 30))
c = 2.5 * b.mean()

I am not sure about d and e.




Aucun commentaire:

Enregistrer un commentaire