0

To the best of my knowledge, the amplitude in an FFT is 10 times its corresponding frequency. For example, if you were to take the FFT of sin(t) from 0 to 2*pi, the FFT would peak at a frequency of .159 Hz and have a corresponding amplitude of 1.59. However, when I add sin(2*t) to sin(t)--y = sin(t) + sin(2*t)--the amplitudes are no longer 10 times the frequencies. Why is that? Thank you in advance for your help.

The image isn't all that helpful but the 2 amplitudes are less than they should be assuming the amplitude is supposed to be 10 times the frequency.

import math
import numpy as np[enter image description here][1]
import numpy.fft as fft
import matplotlib.pyplot as plt

t = np.linspace(0, 2*math.pi, 1600)
y = np.sin(t) + np.sin(2*t)

plt.plot(t, y)
plt.xlabel('time')
plt.ylabel('height')
plt.show()

fft_power = fft.fft(y)
rfft_power = fft.rfft(y)

sample_spacing = 3.92944672e-03

frequency = fft.fftfreq(len(fft_power), sample_spacing)
real_frequency = fft.rfftfreq(len(fft_power), sample_spacing)

plt.plot(real_frequency.real, rfft_power.real, 'ro')
plt.xlabel('frequency')
plt.ylabel('amplitude')
plt.show()
Bobby Stiller
  • 137
  • 1
  • 1
  • 9
  • 2
    Your assumption that FFT result magnitude depends linearly with frequency is incorrect. – hotpaw2 Jul 11 '16 at 16:06
  • Take a look at the numpy documentation here: http://docs.scipy.org/doc/numpy/reference/routines.fft.html#background-information, and in particular at the short section on Normalization: http://docs.scipy.org/doc/numpy/reference/routines.fft.html#normalization – Warren Weckesser Jul 11 '16 at 16:51

0 Answers0