# 2 questions about DSP (beginner)

Status
Not open for further replies.

#### JCO

##### Newbie level 2 Hello,

I’m starting to learn DSP (Matlab )and I have two questions about it, maybe someone can help me out?
I’m trying to measure a frequency from an Audio Device and I’m using FFT to transform it from the time domain to the frequency domain. But I am doing a downsample before the FFT. But you can also do it after the FFT. Do you know what would be the most efficient (before or after)? And why?
Another question, I am using zero padding to increase my system resolution (up to 50Hz). My frame length is N=256 and sample frequency fs= 44100 Hz. So 44100/50 = 882, so I need to add 626 zeroes (to 256 frame length) to get 50 Hz resolution, I hope this is correct? I believe this is done for FFT. But is this the same for the DFT?

Thank you and regards,

#### KlausST

##### Super Moderator
Staff member Hi,

How do you do the downsampling? Why is it necessary?
Do you use an extra sample rate converter, then look into it´s datasheet about noise, harmonic distortion and other introduced errors.

To calculate the FFT frequency resolution you need the downsampled "sample rate".

If you use an radix-2 FFT algorithm you need to use 2^n samples. (n= integer). So 882 samples are not possible. Maybe you need to expand to 1024 samples. Check on this.

For a DFT you usually don´t need the 2^n samples. But to be sure read on your DFT documentation.

Klaus

#### FvM

##### Super Moderator
Staff member Yeah, beyond other points the article clarifies that zero-padding can't increase the frequency resolution.

#### JCO

##### Newbie level 2 Hi,

How do you do the downsampling? Why is it necessary?
Do you use an extra sample rate converter, then look into it´s datasheet about noise, harmonic distortion and other introduced errors.

To calculate the FFT frequency resolution you need the downsampled "sample rate".

If you use an radix-2 FFT algorithm you need to use 2^n samples. (n= integer). So 882 samples are not possible. Maybe you need to expand to 1024 samples. Check on this.

For a DFT you usually don´t need the 2^n samples. But to be sure read on your DFT documentation.

Klaus

Hi,

Thanks for your advise. I was thinking to decrease the sampling rate with a Downsample block in Simulink and see what would the effect of putting it before and after the FFT (in terms of efficiency).
Also thanks for the link about zero padding. Indeed, the radix-2 FFT algorithm requires 2^n samples.

Regards

#### KlausST

##### Super Moderator
Staff member Hi,

44100 Hz / 50 Hz = 882
So if you use a 1024 FFT you should have a frequency resolution less than 50Hz.

Klaus

Status
Not open for further replies.