Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Scipy FFT functions syntax and method
#1
Hi, I am looking at the Fourier Transforms functions provided by the scipy library found at
https://docs.scipy.org/doc/scipy/referen...tpack.html

from scipy.fftpack import fft
# Number of sample points
N = 600
# sample spacing
T = 1.0 / 800.0
x = np.linspace(0.0, N*T, N)
y = np.sin(50.0 * 2.0*np.pi*x) + 0.5*np.sin(80.0 * 2.0*np.pi*x)
yf = fft(y)
xf = np.linspace(0.0, 1.0/(2.0*T), N//2)
import matplotlib.pyplot as plt
plt.plot(xf, 2.0/N * np.abs(yf[0:N//2]))
plt.grid()
plt.show()
Can someone please explain what is happening at line 9 and 11. And why is there a floor division in both lines? 
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  scipy curve_fit for multiple independent variables Jay_Nerella 1 327 May-08-2019, 02:08 AM
Last Post: scidam
  Solve a system of non-linear equations in Python (scipy.optimize.fsolve) drudox 7 6,888 Aug-18-2018, 02:27 AM
Last Post: scidam
  class for ODE, scipy how to switch from fsolve to newton or newton_krylov drudox 0 484 Aug-16-2018, 05:12 PM
Last Post: drudox
  No module named scipy kirill 2 3,482 Mar-16-2018, 04:19 PM
Last Post: kirill
  minimize with scipy.optimize tobenmoben 0 698 Feb-17-2018, 01:47 PM
Last Post: tobenmoben
  [Python][Scipy]Help with Sound Recognition Testing Protocol WebsterAugust 0 848 Nov-12-2017, 01:46 AM
Last Post: WebsterAugust
  Numpy or Scipy Variance Convolution TimWebPhoenix 0 1,311 Jul-11-2017, 12:41 PM
Last Post: TimWebPhoenix
  how to install scipy pikm57 2 1,514 Jun-22-2017, 07:52 PM
Last Post: pikm57
  Scipy question vstradag 1 1,255 Apr-22-2017, 12:43 PM
Last Post: sparkz_alot
  SciPy Intergrate Error Shade5 1 1,429 Nov-17-2016, 05:52 PM
Last Post: nilamo

Forum Jump:


Users browsing this thread: 1 Guest(s)