Improve FFT display resolution by decimation ? - Page 1
Forum section: electronics / rf-microwave

author: prutser
author_rank: Regular Contributor
timestamp: March 05, 2021, 09:31:12 am
content: Suppose I have an ADC with an fs of 100Mhz and an FFT of 8k points.Then my resolution = 100e6/8192 = ~12kHzThis is quite high to show a narrow band signal on a spectrum display, but increasing the FFT to 16 or 32k points is also not desirable.In theory I could decimate the signal by a factor of 4, which would increase the FFT resolution. But does this have any effect, because with decimation youthrow away samples.Any insight in this ?

author: JohnnyMalaria
author_rank: Super Contributor
timestamp: March 05, 2021, 11:20:13 am
content: The lowest frequency you can resolve is determined by how long you collect data for. The period of the lowest frequency is the collection duration. So, if you don't want to increase the number of sample points, then reduce the sampling rate so that the total collection time is longer. Of course, this lowers your upper frequency resolution.By decimating your sample by a factor of 4, you will simply limit the upper resolution to 1/4 of what it currently is. It won't change the lower resolution unless you change the number of data points collected.

author: radiolistener
author_rank: Super Contributor
timestamp: March 05, 2021, 01:22:14 pm
content: Quote from: prutser on March 05, 2021, 09:31:12 amFFT frequency resolution depends on FFT size which depends on sample length.If you decimate signal by a factor 4, sample length will be reduced by a factor 4.As result you will get decrease frequency resolution by a factor 4.In your case, if you apply decimation by a factor 4, you will get frequency resolution 48 kHz instead of 12 kHz with no decimation.If you want to improve frequency resolution, but don't want to increase FFT size, you can shift frequency of interest to zero (multiply input signal with oscillator), then apply low pass filter with decimation and then apply the same FFT size. In such case you will get better frequency resolution due to lower sample rate for a fixed sample length.

author: prutser
author_rank: Regular Contributor
timestamp: March 05, 2021, 04:14:55 pm
content: I explained my intention not completely, of course by directly decimating the input samples, you reduce the highest possible frequency visible.Assuming fs = 100MHz and I am interested in the part between 30-40 MHz, convert this down to baseband followed by decimation.Due to the decimation the fs at baseband lower, which means with the same fft size the resolution becomes higher.

author: radiogeek381
author_rank: Regular Contributor
timestamp: March 05, 2021, 04:38:43 pm
content: You are on the right track.The "bucket size" for the DFT is (assuming complex samples) Fs / N where Fs is the sampling frequency and N is the number of buckets (which will also be the number of sequential samples in the input to the DFT).So, Starting with the idea of Fs_in = 100MHz and the signal of interest at 30-40 MHz.1. Beat the input signal down to 1MHz to 11 MHz by taking the input sample stream and beating it against a complex (I/Q) carrier at 29 MHz. For some information on how this works, seehttps://dspguru.com/files/QuadSignals.pdf2. Downsample from Fs_in to Fs_in / 4 but you don't do this by picking every fourth sample. See a practical DSP handbook -- Again Rick Lyons "Understanding Digital Signal Processing" is quite good.3. Now do the DFT on the resulting stream. Your signals will be in the bottom half of an FFT result if that's what you're using for your DFT.It is *really* important when you use a DFT for a spectrum plot to "window" the input data. If you don't there will likely be a "dc bias" in all your buckets and some other artifacts. In fact, even the resampling step should use a window. Again, see the text.----You could also do this without a quadrature LO, but life will be better for you if you don't. Without the quadrature signal, frequencies above the LO will be mixed in with frequencies below the LO.I generally avoid mixing down to DC as I've found it useful to limit the influence of DC offset and other issues in the signal chain.

author: thinkfat
author_rank: Unknown
timestamp: March 05, 2021, 06:59:27 pm
content: Might make sense for you to look into gnuradio. You can simulate your idea, there's a rich toolbox of signal processing blocks available that will do exactly what you have in mind (the translating decimation block for example).

author: ejeffrey
author_rank: Super Contributor
timestamp: March 05, 2021, 07:05:04 pm
content: Quote from: prutser on March 05, 2021, 09:31:12 amYes, this works totally fine. This is a pretty standard procedure to deal with limited memory for FFT. With decimation you aren't just "throwing away" samples. You first use low-pass filtering first so that adjacent samples are averaged together. That means that nearby samples are highly correlated and discarding 3/4 of them doesn't loose any information.

author: gf
author_rank: Super Contributor
timestamp: March 06, 2021, 01:44:07 pm
content: Quote from: prutser on March 05, 2021, 09:31:12 amDo you want to limit only the FFT to 8k points, or do you have only 8k points available?In order to obtain 8k points after decimation, you still need 32k points as input.If you would decimate from 8k points to 2k points and then calculate the FFT only from 2k points, then you don't gain any resolution.,As radiogeek381 already pointed out, decmiation alone is not sufficient, as it would eliminate the frequency range of interest (30-40MHz), so you need to down-convert first to frequencies < 12.5MHz.Keep in mind that the decimation filter has some computational cost, too - not only the FFT (particularly if the cutoff needs to be close to Nyqist and the transition band is narrow, then a FIR may need quite a couple of taps). You can of course use FFT in order to realize the decimation filtering

author: ejeffrey
author_rank: Super Contributor
timestamp: March 06, 2021, 11:54:11 pm
content: Decimation before FFT, especially if you need to do downconversion is rarely if ever going to be much of a win computationally. FFT is too fast and too well optimized. However it can be worthwhile if you are RAM limited.

author: thinkfat
author_rank: Unknown
timestamp: March 07, 2021, 08:27:52 am
content: Also if you're bandwidth limited.

author: ogden
author_rank: Super Contributor
timestamp: March 07, 2021, 08:46:11 am
content: Quote from: prutser on March 05, 2021, 09:31:12 amYou can change FFT resolution only by incresing it's size. Better approach - discard part of the spectrum you are not interested in. For example when you know that your signal of interest is somewhere in 10..12 MHz range, you can digitally downconvert (DDC) 10..12MHz into 0..2MHz range. Note DDC is mixing+filtering+decimation. Decimation is what you were looking for, right? Then you will have 2e6/8192 = 244 Hz resolution per FFT bin.

author: gf
author_rank: Super Contributor
timestamp: March 07, 2021, 09:46:57 am
content: If the signal of interest (30-40MHz) happens to containonlyfrequencies in the 25-50MZh range, and no frequencies outside this range, then undersampling at 25MSa/s (instead of Nyqusit-sampling at 100MSa/s) were yet another (computationally inexpensive) option to implicitly get both, down-conversion and 4x decimation in a single step.EDIT: Sorry, did't think thoroughly about the frequency plan. Sampling rate needs to be rater between 26.666... and 30 MHz to prevent overlap of positive and negative frequencies. Then the resoution enhancement (compared to 100MSa/s and same number of points) is between 3.333 and 3.75 instead of 4.

author: ogden
author_rank: Super Contributor
timestamp: March 07, 2021, 10:18:05 am
content: Quote from: gf on March 07, 2021, 09:46:57 amRight. Undersampling is downconversion that uses ADC as a mixer and decimator. If analog bandwidth of ADC exceeds nominal sampling frequency (100 MSPS), it can be used to sample >100MHz signals.https://en.wikipedia.org/wiki/Undersampling

author: ejeffrey
author_rank: Super Contributor
timestamp: March 08, 2021, 05:11:32 am
content: Quote from: thinkfat on March 07, 2021, 08:27:52 amI'm not sure what you mean.Frequency resolution is set by the total duration of your sample period. For the same input samples, downconversion + decimation followed by a smaller FFT gives you the same result as just FFTing the original samples and throwing out the points you don't care about. Theoretically the decimation can be cheaper than the full size FFT, but FFTs are so well optimized that it is rare to actually see much benefit. However decimation can be done in a streaming fashion while FFT requires the entire block in memory. So if you have enough memory you would generally just do FFT on the whole input data for simplicity. If you don't then you have to decimate the data as it comes in so that you can fit a long enough sample buffer to get your desired frequency resolution.

author: thinkfat
author_rank: Unknown
timestamp: March 08, 2021, 07:53:51 am
content: Quote from: ejeffrey on March 08, 2021, 05:11:32 amIf you have a constraint on your RAM bandwidth, it's advisable to decimate the signal stream as early as possible so that you don't need to push all that non-information around on your memory bus all the time.

author: ogden
author_rank: Super Contributor
timestamp: March 08, 2021, 08:00:52 pm
content: Quote from: ejeffrey on March 08, 2021, 05:11:32 amDecimation+FFT is way more efficient than FFT + throwing out points. Please get your facts straight, don't spread BS.

author: prutser
author_rank: Regular Contributor
timestamp: March 09, 2021, 07:36:17 pm
content: Thanks for all the replies. Most of them confirm my thoughts. Regarding the questions related to increasing FFT size and RAM. Part is don in an FPGA andthe FFT is done in a CPU. The limitations are both in available sample RAM as well in bandwidth CPU/FPGA and CPU load. So a DDC in combination with smaller FFT fits the bill nicely.

author: gf
author_rank: Super Contributor
timestamp: March 11, 2021, 12:05:27 am
content: A few more thoughs...Once your signal is converted to complex domain (i.e. to a quadrature signal), you can effectively double the FFT resolution by utilizing both, positive and negative frequencies. If you do a FFT of a real signal, then the negative frequencies are always a conjugate complex mirror of the positive ones, i.e. they don't contain additional information, and in many case you just discard them. However, when the input to the FFT is complex, then positive and negative frequencies are not necessarily mirrors, but can contain completely different information.If you down-mix your 30-40MHz band with a complex 35MhzquadratureLO signal, then you effectively shift your frequency band down by 35 MHz. I.e. the 30...35MHz sub-band is moved to -5...0MHz, and 35...40MHz is moved to 0...5MHz. Eventually your 30-40MHz signal ends up at -5...5MHz in your FFT spectrum (i.e. negative frequences don't contain redundant information any more). Since the max. baseband frequency is 5MHz after this down-conversion, you can even decimate by a factor of 8 now, to 12.5MSa/s (instead of 4x if you don't utilize negative frequencies). You also don't need to care about any 0...30MHZ frequencies in your original real signal; they are outside the -5...5MHz band after down-conversion and will be eliminated by the decimation filter.Another issue to consider is the digital LO. For an arbitrary frequency you would rather need to implement e.g. a DDS generator, requiring sin/cos tables of significant size, phase accumulator, phase truncation, etc. The required table can be kept pretty small, though, and not require any phase truncation, if the LO frequency happens to be a smallintegralfraction of the sampling rate. For a 25MHz LO @100MSa/s, the table needs to contain only 4 complex entries [1 + 0j, 0 + 1j, -1 + 0j, -0 - 1j], and for an LO frequency of 10MHz the table needs 10 entries. In order to achieve the avobe mentioned 35MHz down-shift it can be benefitial to do it in two stages, down-shift by 25MHz and then down-shift by 10MHz (because 100 is not an integral multiple of 35). Then the DDS phase accumulator of an LO degrades to a simple counter (current table index) which is incremented by 1 for each processed sample, with wrap-araound at the table size. And a digital qadrature mixer - while this may sound difficult - is not more than a complex multiplication per sample anyway. Tho mixer stages are two multiplications then.Note that mixing two real signal results in sum and difference of the frequencies. However, mixing an input signal with a complex quadrature LO signal exp(-j*omegaLO*t) just shifts all frequencies of the input signal down in the frequency domain (or up, depending on the sign of omegaLO). The shift is circular if we are dealing with discretely sampled signals, whose spectrum wraps around at the Nyqust frequency.