# Complex Samples (IQ) - Baseband Filtering

Signal Processing Asked by Tiaro on October 24, 2020

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.

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.

Correct answer by Dan Boschen on October 24, 2020

If you have a strictly real signal that is bandlimited to well below Fs/4, then you can complex modulate the signal to rotate the spectrum so that it is strictly in the upper (or lower) half of the complex plane (zero complex conjugate). Then you can use strictly real filtering tools on the separated components of the complex signal (e.g. using regular arithmetic instead of complex) to work on the original upper and lower sidebands asymmetrically, and then modulate the resulting signal back down to baseband to get a complex result.

That’s because a strictly real LTI filter applied to a complex signal is equivalent to applying it to the separated components. And also applying this filter to a null half spectrum results in a null half spectrum.

If your filter is complex but symmetric around some axis, you can do something similar to rotate both the data and the spectrum in the complex plane so that you can use strictly real filtering tools on the IQ components. Then rotate back to finish.

Depending on the order of your filter, the two complex modulators can easily cost less than increasing the number of multiply instructions in each filter by 4 to do complex filtering.

Answered by hotpaw2 on October 24, 2020