>Hi Filippo,
>It’s clear that you need to understand the DFT/FFT better, and I have
>provided some links below. Here are some ideas that might get you
started
>in the right direction.
>
>If you want to look at the harmonics of 50 Hz, up to the 50th harmonic,
>you should probably sample at 50 Hz x 128 = 6,400 samples per second.
This
>would require you to provide an anti-alias filter that p*****
frequencies
>up to 2,500 Hz (i.e., 50 Hz x 50), and blocks all frequencies above
3,200
>Hz (i.e., one-half the sampling rate).
>
>Then, take the FFT with N=128, convert the output from rectangular to
>polar form, and discard the phase. This will give you 65 data points,
>providing the amplitudes of the sinusoids: DC, 50Hz, 100 Hz, 150Hz, 200
Hz,
>... 3,200 Hz.
>
>Good luck!
>Steve
>
>http://www.dspguide.com/ch3/2.htm
>http://www.dspguide.com/ch3/4.htm
>http://www.dspguide.com/ch8/2.htm
and forward
>http://www.dspguide.com/ch12.htm
and forward
>
Thanks for your precious help.
By now my code can acquire data, apply a hanning window and digital filter
the sequence as you suggested. I still have some questions, though.
When applying the windowing on the acquired signal I noticed that it is
better to have more than one period in the window to preserve the shape of
the waveform. Should I increase the number of samples and/or the sampling
frequency to preserve the frequency resolution?
Say, for example, that my original intent was to calculate a 256 points
FFT on one period of the signal. According to your suggestion I should
take
a sampling frequency Fs = 256 * 50 = 12800 S/s and with a FIR filter I
should block all frequencies above 6400 Hz. If I want to acquire a longer
sequence with three or four periods in it, how should I change the
parameters?
Another question: I implemented the conversion to polar form by simply
applying the formula: Magx[i] = sqrt(pow(Rex[i],2)+pow(Imx[i],2)). I
expected the first sample to be the fundamental harmonic but I found that
the 50 Hz peak is on a further index of the array. Where I got wrong?
Thanks,
Filippo


|