Tweeted twitter.com/StackElectronix/status/659150417859887105
2 Added graphs
source | link

I've been experimenting with Fourier transforms, and I'd like to understand some of the results I'm seeing.

I've written a simulator which generates a data stream of length 1/120 seconds, sampled at 33.92 nS intervals. The data represents a half-sine wave generated by an inverter. I concatenated this stream with its own negative inverse, to create a single perfectly symmetrical 60 Hz sine wave 491,352 samples long.

enter image description here

I then ran an FFT of the results using numpynumpy.

  Most of the results made sense to me: the FFT was the same length as the original signal. Discrete Fourier results are symmetrical about the fundamental, so I have half that many "bins" (about 246,000) to represent harmonics. The lowest frequency content in the original signal is 60 Hz. ThePer Nyqist, the original signal can not represent frequencies higher than 1/(2*33.92 nS) = 14.74 MHz, which is also the roughly 246,000 harmonic of 60 Hz. So each bin represents one harmonic of the 60 Hz fundamental, with no skipped bins. If I tried transforming five full sine waves instead of just one, four out of every five bins was zero, which makes sense; those bins represent fractional harmonics, which are meaningless.

Going back to my single-wave FFT, every even-index (index from zero) entry of my FFT results is zero. Every odd entry is non-zero, with index [1]1 being by far the largest. This makes sense if [1]1 is the fundamental, because the even harmonics won't show up in a symmetrical sine wave. But why is the first entry in the FFT results not the fundamental?

After this, I applied an LC filter, by iterating through the FFT results and multiplying each bin by the filter gain at that frequency. I then did an inverse FFT, giving me the filtered time-domain signal. The result has both real and imaginary components. The real component and the imaginary component, when taken separately, each look like what I expected the time domain signal to look like: a better looking sine wave than I started with, shifted by 90 degrees relative to each other.

enter image description here

But the magnitude is pretty much constant, rather than looking at all line a sine wave. This is not at all what I was expecting. What is the significance of this result?

I've been experimenting with Fourier transforms, and I'd like to understand some of the results I'm seeing.

I've written a simulator which generates a data stream of length 1/120 seconds, sampled at 33.92 nS intervals. The data represents a half-sine wave generated by an inverter. I concatenated this stream with its own negative inverse, to create a single perfectly symmetrical 60 Hz sine wave 491,352 samples long. I then ran an FFT of the results using numpy.

  Most of the results made sense to me: the FFT was the same length as the original signal. Discrete Fourier results are symmetrical about the fundamental, so I have half that many "bins" (about 246,000) to represent harmonics. The lowest frequency content in the original signal is 60 Hz. The original signal can not represent frequencies higher than 1/(2*33.92 nS) = 14.74 MHz, which is also the roughly 246,000 harmonic of 60 Hz. So each bin represents one harmonic of the 60 Hz fundamental, with no skipped bins. If I tried transforming five full sine waves instead of just one, four out of every five bins was zero, which makes sense; those bins represent fractional harmonics, which are meaningless.

Going back to my single-wave FFT, every even-index (index from zero) entry of my FFT results is zero. Every odd entry is non-zero, with index [1] being by far the largest. This makes sense if [1] is the fundamental, because the even harmonics won't show up in a symmetrical sine wave. But why is the first entry in the FFT results not the fundamental?

After this, I applied an LC filter, by iterating through the FFT results and multiplying each bin by the filter gain at that frequency. I then did an inverse FFT, giving me the filtered time-domain signal. The result has both real and imaginary components. The real component and the imaginary component, when taken separately, each look like what I expected the time domain signal to look like: a better looking sine wave than I started with, shifted by 90 degrees relative to each other. But the magnitude is pretty much constant, rather than looking at all line a sine wave. This is not at all what I was expecting. What is the significance of this result?

I've been experimenting with Fourier transforms, and I'd like to understand some of the results I'm seeing.

I've written a simulator which generates a data stream of length 1/120 seconds, sampled at 33.92 nS intervals. The data represents a half-sine wave generated by an inverter. I concatenated this stream with its own negative inverse, to create a single perfectly symmetrical 60 Hz sine wave 491,352 samples long.

enter image description here

I then ran an FFT of the results using numpy. Most of the results made sense to me: the FFT was the same length as the original signal. Discrete Fourier results are symmetrical about the fundamental, so I have half that many "bins" (about 246,000) to represent harmonics. The lowest frequency content in the original signal is 60 Hz. Per Nyqist, the original signal can not represent frequencies higher than 1/(2*33.92 nS) = 14.74 MHz, which is also the roughly 246,000 harmonic of 60 Hz. So each bin represents one harmonic of the 60 Hz fundamental, with no skipped bins. If I tried transforming five full sine waves instead of just one, four out of every five bins was zero, which makes sense; those bins represent fractional harmonics, which are meaningless.

Going back to my single-wave FFT, every even-index (index from zero) entry of my FFT results is zero. Every odd entry is non-zero, with index 1 being by far the largest. This makes sense if 1 is the fundamental, because the even harmonics won't show up in a symmetrical sine wave. But why is the first entry in the FFT results not the fundamental?

After this, I applied an LC filter, by iterating through the FFT results and multiplying each bin by the filter gain at that frequency. I then did an inverse FFT, giving me the filtered time-domain signal. The result has both real and imaginary components. The real component and the imaginary component, when taken separately, each look like what I expected the time domain signal to look like: a better looking sine wave than I started with, shifted by 90 degrees relative to each other.

enter image description here

But the magnitude is pretty much constant, rather than looking at all line a sine wave. This is not at all what I was expecting. What is the significance of this result?

1
source | link

What is the meaning of my fourier transform results?

I've been experimenting with Fourier transforms, and I'd like to understand some of the results I'm seeing.

I've written a simulator which generates a data stream of length 1/120 seconds, sampled at 33.92 nS intervals. The data represents a half-sine wave generated by an inverter. I concatenated this stream with its own negative inverse, to create a single perfectly symmetrical 60 Hz sine wave 491,352 samples long. I then ran an FFT of the results using numpy.

Most of the results made sense to me: the FFT was the same length as the original signal. Discrete Fourier results are symmetrical about the fundamental, so I have half that many "bins" (about 246,000) to represent harmonics. The lowest frequency content in the original signal is 60 Hz. The original signal can not represent frequencies higher than 1/(2*33.92 nS) = 14.74 MHz, which is also the roughly 246,000 harmonic of 60 Hz. So each bin represents one harmonic of the 60 Hz fundamental, with no skipped bins. If I tried transforming five full sine waves instead of just one, four out of every five bins was zero, which makes sense; those bins represent fractional harmonics, which are meaningless.

Going back to my single-wave FFT, every even-index (index from zero) entry of my FFT results is zero. Every odd entry is non-zero, with index [1] being by far the largest. This makes sense if [1] is the fundamental, because the even harmonics won't show up in a symmetrical sine wave. But why is the first entry in the FFT results not the fundamental?

After this, I applied an LC filter, by iterating through the FFT results and multiplying each bin by the filter gain at that frequency. I then did an inverse FFT, giving me the filtered time-domain signal. The result has both real and imaginary components. The real component and the imaginary component, when taken separately, each look like what I expected the time domain signal to look like: a better looking sine wave than I started with, shifted by 90 degrees relative to each other. But the magnitude is pretty much constant, rather than looking at all line a sine wave. This is not at all what I was expecting. What is the significance of this result?