I am trying to use a fast fourier transform to extract the phase shift of a single sinusoidal function. I know that on paper, If we denote the transform of our function as T, th
Your points are not distributed equally over the interval, you have the point at the end doubled: 0
is the same point as 1
. This gets less important the more points you take, obviusly, but still gives some error. You can avoid it totally, the linspace
has a flag for this. Also it has a flag to return you the dt
directly along with the array.
Do
t, dt = np.linspace(0, 1, num_t, endpoint=False, retstep=True)
instead of
t = np.linspace(0,1,num_t)
dt = 1.0/num_t
then it works :)