Skip to content

Commit 5372836

Browse files
committed
added comments to the code
1 parent 4ed3db9 commit 5372836

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
from scipy.fft import fft, ifft
22
import numpy as np
33

4+
# using the convolutional theorem
45
def convolve_fft(signal1, signal2):
56
return ifft(np.multiply(fft(signal1),fft(signal2)))
67

7-
8+
# Random distribution in x
89
x = np.random.rand(100)
10+
11+
# Gaussian signals
912
y = [np.exp(-((i-50)/100)**2/.01) for i in range(1,101)]
1013

1114
x /= np.linalg.norm(x)
1215
y /= np.linalg.norm(y)
1316

17+
# Convolving the two signals
1418
fft_output = convolve_fft(x, y)
19+
1520
np.savetxt("fft.dat", fft_output)
1621

0 commit comments

Comments
 (0)