# Complex Samples (IQ) - Baseband Filtering

We are currently analyzing a large set of IQ samples in a desktop application and we are interested in implementing many different bandpass filters dynamically.

We realized, that working with scipy offers no suppport for complex bandpass filtering.

We have already checked following link which suggests a solution to the problem when it is decided to approach the problem with complex filters: How to implement bandpass filter on complex valued signal?

We wonder, why that is even necessary, since the data could be transformed to a real format. Instead of $$[-f_s/2, f_s/2]$$ the range is from $$[0,fs]$$ (mirrored about the $$0\,Hz$$ point). This way already implemented filtering tools could be used.

• Just as your signal spectrum wraps around the unit circle in the z plane and has aliases, so does the frequency response of your filter. Real filters have an image at negative frequency and that will show up and an alias as you move around the unit circle in the z plane. There is no free lunch. If you want a one sided filter, the Fourier Transform theorems tell you that your filter taps must be complex. Jul 24, 2020 at 15:40
• If we didn't misunderstand you @AndyWalls, we totally agree with your point. But why wouldn't you just mutiply the IQ samples by $\cos (2 \pi f_s/2)$ to shift their spectrum in both directions by $f_s/2$, such that the spectrum becomes symmetric and thus the samples become real? Jul 24, 2020 at 15:50

A real signal is complex conjugate symmetric, so any filter over $$-fs/2$$ to $$+fs/2$$ is really only unique over the range from $$0$$ to $$fs/2$$. This would be a primary motivation for working with a fully complex signal as the unique range is then truly extended over the full $$-fs/2$$ to $$+fs/2$$ range.

Another more dominant reason to implement a complex filter besides the bandwidth requirement outlined above (where the choice is really sample twice as much or carry two datapaths; similar complexity and certainly you could map either to be similar if that was the only goal) is when the passband itself is not symmetric: specifically as a bandpass filter when the positive frequency passband is not equal and magnitude and conjugate in phase to the negative frequency, or as a baseband filter- the passband shape itself is asymmetric or perhaps completely one sided. Another dominant reason is when real signal conditions would create images very close to the signal where further filtering would be difficult, such as if conditions require operating very close to the Nyquist boundary. If the OP doesn't have these conditions, I don't see a strong motivation for complex filtering, which requires 4 real multipliers for every complex multiplication operation (assuming complex inputs and outputs).

Channel equalization is another example where a full complex filter is often necessary (as an implementation on a baseband signal) but not needed for a passband signal.

• What about SNR considerations? Jul 25, 2020 at 0:24
• @CedronDawg What is your question exactly? Comparing what to what specifically? In most use cases there isn't an SNR difference (both the signal and the noise are -3dB in the positive and negative frequency) but the ability to simplify filtering, separation of images, unless you are doing something completely incorrectly (such as using complex processing on a real signal) - but maybe you are thinking of something else--- let me know more details /specifics of your question-- or if you have insights to share. Jul 25, 2020 at 0:58
• Well, the RMS of a pure complex tone is 1.0, while a real tone is 0.707. On a Db scale that is a drop of 1.5. In "power" it's 3 dB. In particular, the SNR is low at zero crossings for a real tone, with the peak being the max. A complex tone is at max throughout the cycle. So, it's another tradeoff consideration. For someone like me who often does stuff down in the one to two cycle range, it sure seems significant. Jul 25, 2020 at 1:33
• @Cedron Keep in mind that the pure complex tone has twice the noise from I + jQ which is +3dB so no change in SNR for your example! When we take the real part of a signal in the receiver, the noise drops by 3dB, this is the motivation to rotate BPSK signals to the real axis and then once carrier recovery is done take the real part to get the +3dB gain. But yes there are a lot of advantages and motivations to use complex signals (I much prefer them-- but SNR doesn't seem to be one of them at least in this context). The max through its cycle is consistent with no image issue. Jul 25, 2020 at 1:36
• (Meaning to the extent the noise on the real and imaginary axis are independent noise processes, there would be a drop of 3 dB when you go from complex to real) This may be helpful dsp.stackexchange.com/questions/54251/… Jul 25, 2020 at 1:39

• If you have a pure tone with a frequency between $F_s/4$ and $F_s/2$, the range of 4 samples per cycle down to 2 samples per cycle, or as I like to think of it, from the sweet spot to Nyquist, you can simply flip the sign of every other sample. This is the equivalent of rotating the the conjugate pair by a Nyquist pure complex tone. Therefore they end up as a conjugate pair between DC and $F_s/4$ in frequency, the phase negated and the magnitude preserved. Something I figured out to my chagrin after an attempt to try it a different way. dsp.stackexchange.com/questions/69325 Jul 26, 2020 at 0:10