if the number of samples for doing fft is not n power of 2 the results accuracy would be affected or it is just matter of speed of calculations ?

69 ビュー (過去 30 日間)
Hello
I am wondering if I use 10000 samples and do the fft my results would be much different comparing to when I have exactly the samples equal to n power of 2 ? is Matlab doing the zero padding automatically ? or I should do zero padding ?
further information :
I am using matlab version 2012b, fft function to perform the dft on my samples. I have the time domain data for 10 minutes with sampling rate of 50 KHz. type of my work necessitates me to devide the time domain data in 200 ms windows. and after performing the fft on these 200 ms windows, I make an average over the different window results. 200 ms in 50 Hz frequency system which is sampled by 50Khz means about 10000 samples for each fft operation.
regards, Ali
  2 件のコメント
Greg Dionne
Greg Dionne 2014 年 8 月 15 日
You won't need to do zero padding, so feel free to just use your samples as-is.
MATLAB internally computes the FFT without any zero padding at all. Since your sample size is easily factorizable into small primes (10000 = 2*2*2*2*5*5*5*5), it will break down the FFT into smaller sizes. Then it will use split- and mixed- radix FFT's to build the larger 10,000 pt. FFT.
If you have a large prime factor, P, the FFT will use Rader's algorithm to sub-divide that portion of the FFT into a circular convolution of size P-1.
Hope this helps.
-Greg
Ali
Ali 2014 年 8 月 24 日
thanks Greg, but 10000 samples is just a sample to get round answer for calculations . in reality it ranges between 9980 to 10020! now i have got a problem with the result of zero padding as I have explained below !

サインインしてコメントする。

採用された回答

Daniel kiracofe
Daniel kiracofe 2014 年 8 月 17 日
There are two reasons to zero pad an fft. First reason is speed. A sample size that is a power of two is going to be the fastest possible. A sample size that is factorizable into small primes is a little slower. A prime number is slowest. However, for modern computers and a sample size on the order of 10,000 this is probably the difference between the fft taking 50 ms and it taking 60 ms. I'm guessing here, I haven't actually tried it, but you probably won't even notice the difference. Now in 1970, this might have been the difference between 5 minutes and 6 minutes, so it was a big deal back then.
Now, if you want to do 100,000,000 sample sizes, then maybe it makes a difference.
The other reason to zero pad an FFT is to a little better frequency resolution. I give some demonstrations on this on a little tutorial I wrote here: http://mechanicalvibration.com/Zero_Padding_FFTs.html
  1 件のコメント
Ali
Ali 2014 年 8 月 24 日
編集済み: Ali 2014 年 8 月 24 日
Thanks a lot Daniel. your answered helped me much. now another question come up . Is there any way to get back to the original freqeuncy resolution after zero padding ? (further explanation : with 1000 samples, i Interpolated to 2^14 number of samples and afterwards I did FFT so in this way each frequency bin is 5Hz which means that 50Hz frequency domain is shown by bin number 10, but after zero padding my 50Hz freqeuncy is being shown by bins of 17 and 18 which means I have not the same frequency resolution. therefore I am wondering if there is any way to show the domain of 50Hz component again in frequency bin of number 10 ?(as a unique frequecy bin))
thanks in advance .

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpectral Measurements についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by