vendredi 11 octobre 2019

How can i find Auto correlation and Cross correlation for two random arrays?

I have 2 random arrays like in the codes. I need to find auto-correlation and cross-correlation both of them. I wrote the codes. Is it true?

Here's the codes:

import numpy as np
import matplotlib.pyplot as plt
from scipy import signal

t=np.arange(0,600,0.004)
a1=np.random.rand(*t.shape)
a2=np.random.rand(*t.shape)
plt.plot(signal.correlate(a1,a2)) #cross-correlation
plt.figure()
plt.acorr(a1) #auto-correlation for first random array.
plt.figure()
plt.acorr(a2) #auto-correlation for second random array.



Aucun commentaire:

Enregistrer un commentaire