Why does numpy FFT only work for samples of 10,20,30 sec?

I'm using numpy FFT functions to find the amplitude, frequency and phase of low frequency signals. focusing between 0-10 hz.Part of my project is to vary the time over which the sample is taken and the sample frequency. To test the function im currently using unit amplitudes and set frequencies. At any sample size other then 10,20 sec .. ect the fft becomes rather inaccurate.

Since i am using unit amplitudes of 1, the outputs should all be 1, or at least the same number if my scaling is off. but i am getting aptitude outputs from 1 to 0.66 when not using a sample of a multiple of 10.

i have tried changing both the sample time and frequency to match the total sample size but this doesn't seem to have any effect.

Why does this happen? i can't find anything about why the FFT only works for these discrete time periods.

functions use:

z = Series(ampl_OR[i] * np.cos(2np.pifreq_OR[i]*t_OR + phase_OR[i]))

Ramp = np.fft.fft(z) #real amplitudes used to find phase

Rfeq = np.fft.fftfreq(z.shape[-1]) #real frequency domain to find phase

• en.wikipedia.org/wiki/Spectral_leakage – Ben Mar 14 at 19:41
• In your case, your frequencies have a whole number of periods in a 10-second, 20-second or 30-second window. So you have no leakage. With a period of 11 seconds, you have spectral leakge. – Ben Mar 14 at 19:42
• Related – OverLordGoldDragon Mar 15 at 1:23
• Im focusing on measuring these low frequencies looking at real world applications, how would i reduce the leakage effect?? – Jacob wood Mar 16 at 10:51