2
$\begingroup$

I ran into a strange bug while implementing a complex band-pass filter. The filter design process is based on the windowing method and seems to be working well, but when i apply the coefs of the filter on my time domain input samples and perform DFFT the carrier frequency is doubled. I can´t really figure out why is this happening but my guess is that i'm doing something bad during the convolution. The first plot shows the magnitude response of the complex band pass filter. The second plot shows FFT of my input 5kHz carrier signal, the third one shows the same data but with BP filter applied. Everything is happening in the complex plain.

complex band pass filter

No filter applied - 5kHz carrier Band-pass filter applied on the same 5kHz carrier input

$\endgroup$
  • $\begingroup$ You must describe exactly what you're doing, otherwise there is no way for us to figure out what's happening. You could also plot the frequency response of the filter. $\endgroup$ – Matt L. Mar 6 '16 at 19:31
  • $\begingroup$ Firstly i compute the filter coefs using firdes class from GNU radio, see: github.com/gnuradio/gnuradio/blob/… $\endgroup$ – r.a.m- Mar 6 '16 at 19:39
  • $\begingroup$ Compute the FFT of the (zero-padded) filter coefficients and include the plot in your question. $\endgroup$ – Matt L. Mar 6 '16 at 19:44
  • $\begingroup$ BTW, I don't think that the filter coeffs are the problem but let's start at the beginning ... $\endgroup$ – Matt L. Mar 6 '16 at 19:45
  • $\begingroup$ I have a low rep so can't post more than 2 images at the moment. FFT of coefs is here i.stack.imgur.com/7huYn.jpg $\endgroup$ – r.a.m- Mar 6 '16 at 20:06
2
$\begingroup$

You complex multiplication code inputs 2 samples for every output sample. That will act as a frequency doubler.

$\endgroup$
1
$\begingroup$

I found the origin of the problem while double checking the whole iplementation of my application. I added a method for reading a single input sample from binary file few weeks ago, but I somehow messed up the size of the buffer which I use. It has to be 8-byte long (room for 2 floats) representing real and imaginary part of the sample, but I used 16 bytes instead. Really stupid mistake! Thanks for your hepl, I appriciate it!

$\endgroup$
0
$\begingroup$

what's your sample frequency, fm? did you apply Nyquist theorem? You may need to do fm/2=fe and then transform the pass band, Wp, and the band eliminated, Ws, into Wp/fe and Ws/fe.

$\endgroup$

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.