DSPRelated.com
Forums

Problem with FFT

Started by Unknown February 8, 2007
Hi,

I use a FFT and when I send a pure 1 MHz sinus in my 1024 pts FFT
sampled at 10 MHz, I have a lot of amplitude variation in the output
visualization.. 20% variation

I send to the complex FFT, the 1MHz sinus sampled at 10 MHZ at the
input real part and '0' at the input imaginary part...

>From the FFT ouput, I compute Re[X(n)]^2 + Im[X(n)]^2 so I have the
squared magnitude with a linear scale... I think this is because my 1 MHz sinus is not synchrone with the 10 MHz sampling frequency... So how to do in this case... Thanks
On Feb 8, 12:01 pm, patrick.me...@dmradiocom.fr wrote:
> Hi, > > I use a FFT and when I send a pure 1 MHz sinus in my 1024 pts FFT > sampled at 10 MHz, I have a lot of amplitude variation in the output > visualization.. 20% variation > > I send to the complex FFT, the 1MHz sinus sampled at 10 MHZ at the > input real part and '0' at the input imaginary part... > > >From the FFT ouput, I compute Re[X(n)]^2 + Im[X(n)]^2 so I have the > > squared magnitude with a linear scale... > > I think this is because my 1 MHz sinus is not synchrone with the 10 > MHz sampling frequency... > > So how to do in this case... > > Thanks
I'm not sure what you mean by "20% variation", but if you're expecting to see a peak at one frequency bin and zero at all of the rest, you're not going to with the parameters you specified. When you perform a DFT on a set of data, you have implicitly taken that infinite-duration function and multiplied it times a rectangular window (or another one if you windowed it separately); this results in the convolution of the DFT with the DFT of the window function (in the rectangular case, a sinc). If the FFT length and sampling rate are such that the frequency bins line up with the zeros of the sinc, then you will see a single peak; otherwise, you see a "smeared out" peak. Jason
On 2=A4=EB9=A4=E9, =A4W=A4=C81=AE=C901=A4=C0, patrick.me...@dmradiocom.fr w=
rote:
> Hi, > > I use a FFT and when I send a pure 1 MHz sinus in my 1024 pts FFT > sampled at 10 MHz, I have a lot of amplitude variation in the output > visualization.. 20% variation > > I send to the complex FFT, the 1MHz sinus sampled at 10 MHZ at the > input real part and '0' at the input imaginary part... > > >From the FFT ouput, I compute Re[X(n)]^2 + Im[X(n)]^2 so I have the > > squared magnitude with a linear scale... > > I think this is because my 1 MHz sinus is not synchrone with the 10 > MHz sampling frequency... > > So how to do in this case... > > Thanks
Hi Patrick, Without seeing your code or magnitude response, I would guess that it is spectrum leakage that you observed as 20% variations in non-1Mhz bins. I suggest you that using windowing for spectrum analysis w/ FFT. You can refer to Rick Lyon's book "Understanding Digital Signal Processing" which has many good pages about leakage and windowing. Sincerely, Merlin
I wrote a little mistake...

In fact I have chosen a sampling frequency of 10.24 MHz with a 1024
pts FFT, so my 1 MHz sine at the input of the FFT produce a single
frequency bin.

As I compute the FFT in real time, and see the result on a scope, I
see that the amplitude of the frequency bin is not constant but varies
from 20%... There's a low frequency modulation on my peaks, if I
change my input frequency 1.000200 MHz the frequency of the amplitude
modulation is not the same

I have put a Hamming window too before sending the samples to the FFT
but I don't use overlapp...

If I only send to the FFT 1024 samples is it an inplicit rectangular
window ?

Thanks.

Hi Patrick,

> In fact I have chosen a sampling frequency of 10.24 MHz with a 1024 > pts FFT, so my 1 MHz sine at the input of the FFT produce a single > frequency bin. > > As I compute the FFT in real time, and see the result on a scope, I > see that the amplitude of the frequency bin is not constant but varies > from 20%... There's a low frequency modulation on my peaks, if I > change my input frequency 1.000200 MHz the frequency of the amplitude > modulation is not the same
I don't have the experience of computing FFT and checking the result by a scope. So can you explain your experiment environment a little clearer? If I must guess, I would ask: 1. Do you ever see a single bin, resulted from whatever signal, on your scope? 2. Can you measure the modulation frequency? Is it the frequency of your power line or your light? I saw this on my oscilliscope, but I'm not sure if it is observable on your scope (which I don't what it is).
> > I have put a Hamming window too before sending the samples to the FFT > but I don't use overlapp... > > If I only send to the FFT 1024 samples is it an inplicit rectangular > window ?
Yes. It's a rect window. However, your input signal is so perfect that there are exactly 100 cycles of 1MHz sine wave in your 1024 samples. This is a case in which you need no windowing. Sincerely, Merlin