Two problems:
First: ‘fs’ is the inverse of the sampling interval, or 1E+6.
Second, your code is correct although your plot is not. You can only plot to the Nyquist frequency (½ the sampling frequency), so your xlim call should be:
Also, you need to normalise the fft result by dividing it by the length of your data vector:
and then multiply it by 2 to get the approximately correct amplitude in the plot.
Those changes result in a correct fft plot.
0 件のコメント
サインイン to comment.