How to show that DFT follows N^2 number of operations?

3 次查看(过去 30 天)
Hey!
Let's say I have a matrix with 4096 data in one column.FIrst, I took 256 data from that to perfom DFT(without FFT) and FFT both and record the time needed for each operation. Then I took 1 to 512 data and do the same. Similarly I took 1 to 1024 data to perform the same operation and kept going like this till 4096.
It is known that number of operations for FFT follows N logN trend (where N is the sample size) and DFT follows N^2 trend. I am trying to plot for time required for each operation vs number of sample and somehow show that they follow the trends as mentioned. I am not understanding if I should do a polyfit or just loglog plot for both axes and see the curve is linear for both cases or not. What should I do in this case?
Any help will be appreciated.

采纳的回答

Chunru
Chunru 2022-9-23
One simple way is to plot sqrt(dft_time) vs n to see if it is a straight line.
Generally speaking, the computation time can be a very complicated thing. The DFT/FFT computations not only depending on the number of mulitplication/addtions (N^2 and N*log2(N)), but also depend on how the coefficients are computed and how memory are accessed (espcially with cache memory structure) and how index are generated, never mentioning the overhead of fft implementation in matlab.
  5 个评论
Raushan
Raushan 2022-9-23
For N^2 I used P= polyfit(x, dft_time,2) Plot(x, p(1).*x^2)
And I got linear trend. I am trying similar for fft to fit N*Log(N) but not getting linear.
Do I need to use some other fit for this?

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Spectral Measurements 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by