0
$\begingroup$

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.

$\endgroup$
2
  • 1
    $\begingroup$ 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. $\endgroup$
    – Andy Walls
    Jul 24 '20 at 15:40
  • $\begingroup$ 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? $\endgroup$
    – Tiaro
    Jul 24 '20 at 15:50
0
$\begingroup$

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.

$\endgroup$
13
  • $\begingroup$ What about SNR considerations? $\endgroup$ Jul 25 '20 at 0:24
  • $\begingroup$ @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. $\endgroup$ Jul 25 '20 at 0:58
  • $\begingroup$ 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. $\endgroup$ Jul 25 '20 at 1:33
  • $\begingroup$ @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. $\endgroup$ Jul 25 '20 at 1:36
  • $\begingroup$ (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/… $\endgroup$ Jul 25 '20 at 1:39
0
$\begingroup$

If your filter is real:

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.

$\endgroup$
2
  • $\begingroup$ 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 $\endgroup$ Jul 26 '20 at 0:10
  • $\begingroup$ @hotpaw2 As we understand from your post, the only restriction from transforming a complex signal into a real one is the sampling rate. If we upsampled the signal, it would be possible to transform it to real form. Since there is plenty of computing power (CPU and GPU) and enough memory, we see no reason to not transform to real form. The reason is, we wish to use standard filtering tools, which are unfortunately only implemented for real signals in the libraries we use (scipy and numpy). Basically we try to avoid implementing self-made, error-prone DSP-algorithms. $\endgroup$
    – Tiaro
    Jul 27 '20 at 8:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.