Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cc0ec22

Browse files
Merge pull request #1312 from ayulockin/patch-1
Correction required in array slicing for frq & Y
2 parents 5dd86ee + ecccf1f commit cc0ec22

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

_posts/matplotlib/fft/2015-04-09-mpl-basic-fft.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
k = np.arange(n)
2525
T = n/Fs
2626
frq = k/T # two sides frequency range
27-
frq = frq[range(n/2)] # one side frequency range
27+
frq = frq[range(int(n/2))] # one side frequency range
2828

2929
Y = np.fft.fft(y)/n # fft computing and normalization
30-
Y = Y[range(n/2)]
30+
Y = Y[range(int(n/2))]
3131

3232
fig, ax = plt.subplots(2, 1)
3333
ax[0].plot(t,y)

0 commit comments

Comments
 (0)