Skip to main content
15 events
when toggle format what by license comment
Feb 12, 2018 at 14:41 comment added Usman Ashraf It was to set different L's in the powers of 2. For example, 256, 512, 1024, 2048 etc.
Feb 12, 2018 at 14:05 comment added Gilles @UsmanAshraf , why do you have the "+3" in 2^( nextpow2( lenData ) + 3) ?
Feb 12, 2018 at 11:24 comment added Usman Ashraf @Giles I am using a very similar code but have different results for energy. Maybe because your signal is a periodic sinusoid. Will your observation remain valid if signal is not periodic. 'lenData = length( data ); L = 2^( nextpow2( lenData ) + 3); Y = fft(data, L)/L; Y3energy = (Y.*conj(Y)); energy3 = sum(Y3energy); energy1 = sum(abs(data).^2);'
Feb 12, 2018 at 11:16 history edited Gilles CC BY-SA 3.0
added 17 characters in body
Feb 12, 2018 at 11:15 comment added applesoup @UsmanAshraf, it is not directly possible to use a DFT length smaller than the signal length but still take the complete signal into account. If you want a lower resolution of the DFT, it may be possible to 1. compute the DFT with the length of the signal and 2. interpolate the result to find the spectrum in the desired (lower number of) bins.
Feb 12, 2018 at 10:59 comment added Gilles @UsmanAshraf, please see the edit in my answer.
Feb 12, 2018 at 10:56 history edited Gilles CC BY-SA 3.0
filling up on OP comments
Feb 12, 2018 at 10:49 comment added Usman Ashraf @applesoup, can you suggest a way in which I don't lose information from the signal and still be able to reduce the NFFT below the input sample length. I want to do this for the more optimized implementation on verilog (hardware design language).
Feb 12, 2018 at 10:41 comment added Usman Ashraf @applesoup, this is exactly what I have observed in matlab code. If I reduce NFFT below the signal length, the energy value is the same as if the last samples of the signal X are dropped from it.
Feb 12, 2018 at 10:14 comment added applesoup I think it is also important to note that not all signal samples will be used for the spectrum computation if the DFT length is lower than the signal length. Of course, this is related to a reduced frequency resolution, but may have further consequences, e.g., if the signal is nonzero only in the last samples.
Feb 12, 2018 at 9:58 comment added Usman Ashraf I understand your point that the resolution of the bins would worsen as N is decreased. But when I use the produced fft indexes to compute the energy in the signal, that gives me the wrong answer. Can you explain, why I can't use Y = fft(data, L); Y3energy = (Y.*conj(Y))/L; energy3 = sum(Y3energy); to find the energy of the in the signal.
Feb 12, 2018 at 9:56 history edited Gilles CC BY-SA 3.0
deleted 1 character in body
Feb 12, 2018 at 9:09 history edited Gilles CC BY-SA 3.0
added 97 characters in body
Feb 12, 2018 at 8:53 history edited Gilles CC BY-SA 3.0
added 409 characters in body
Feb 12, 2018 at 8:46 history answered Gilles CC BY-SA 3.0