## 'Phase drift' if oscillator doesn't go through full 360 deg rotation when mixing FIR to bandpass

Started by 7 years ago●21 replies●latest reply 7 years ago●377 viewsHello all, I've just started reading and researching signal processing and the application I'm working on involves decimating samples and filtering to go from a relatively large band to a much smaller band. Anyway, from reading a textbook (Understanding Digital Signal Processing - Lyons 1996 - great book) I learned you can shift a digital lowpass to a bandpass by mixing with an oscillator at a desired frequency. I came across some documentation from colleagues on a similar project, in which they write:

In general the signal(s) of interest are not at baseband, so it [is] necessary to mix the signal to baseband. Since the filter stage involves a multiplication performed on every input sample anyway, we can just perform filtering AND frequency translation in the same step. The filter taps are first multiplied by the desired oscillator function. Then the filter taps are “convolved” with the input samples. Since the oscillator may not complete an exact 360 degree rotation in the span of the FIR filter, there may be some residual (but deterministic) phase drift in the decimated output that must be corrected.

In the texts I read, I didn't come across anything about a phase drift introduced if the oscillator doesn't perform a full 360 degree rotation. Any experts out there that can maybe help me understand what this documentation is trying to say?

Thank you. Of course - if I'm missing any information to give context please let me know and I'll do my best to provide the relevant information.

The way I would describe what I think they are saying is that their oscillator frequency doesn't have an exact integer ratio to the decimated frequency. The technique that I think they're doing (note all of the "I thinks" here) will only down-convert at exact harmonics of the decimated frequency. If their oscillator doesn't match, then they'll get the "phase drift" they talk about when the decimation enforces that exact harmonic relationship.

(I'm going to have to go off and try what I think they're doing -- if it works it's clever.)

Do these people still live and work at your company? Sometimes nothing can achieve clarity like a visit to a co-worker's cube.

Hi Tim,

Unfortunately the person is gone and they were at a different location so I do not know where they ended up.

I'll be interested to see what you tried!

Thanks

I personally don't get it. Though it is just my immediate thoughts. If you multiply filter by frequency(f) it will move the filter centre to (f) frequency before it is applied to signal.For example if signal centre is at 10MHz and you applied -10MHz to filter your filter moves to zero yet signal is at 10MHz so how can it do filtering.

Kaz

Hi kaz,

As I understand it, the filter starts out as a low pass, then in order to shift it to a bandpass to get the signal of interest, they multiply it by the desired centre frequency, though I'm not sure...

Example would be the signal of interest is at 12MHz, and the filter is then multiplied by an NCO of 12MHz to make it a bandpass and to get the signal of interest.

I think this is what is happening, but what I don't understand is if the phase offset they speak of is a problem or not - if the NCO doesn't have an integral number of wavelengths over the filter... I can't find reference to it in any DSP theory.

Hi Kevinjkrieger

If FIR is designed in baseband and then frequency shifted to 12MHz then it is no problem and it will filter the signal around 12MHz but will not shift it to baseband. So if you mean just frequency shift of filter(rather than signal) then you multiply it by cos (to keep FIR symmetry). I am not sure if you need full cycles over filter span but you can model that or just design your FIR span to cover full cycles.

Kaz

Hi Kaz,

Hmmm... I'm sorry I think I got confused for a minute there. It looks like in the colleague's code he had a low pass FIR filter, then he applied the NCO to it to frequency shift the samples to baseband and to also filter them at the same time.

Seems like the two operations are equivalent to me, which would mean the colleague's code is NOT actually getting the signal to baseband?

So, you want to approximate

$$y_1(t) = \left (x(t) \cdot e^{-jw_{1}t} \right ) * h(t)$$

where \(x(t)\) is your input signal, * is the convolution operation, \(w_{1}\) is the frequency shift, and \(h(t)\) is the impulse response of your filter,

by the following equation

$$y_2(t) = x(t) * \left( h(t) \cdot e^{-jw_{1}t} \right )$$

where \(T_h\) is equal to the time length of \(h(t)\)

(replacing \(t\) by \(kT\) to convert to discrete time domain),

to reduce computation requirements?

They are not equivalent. In the first equation you do a frequency shift in x(t), then you filter the signal. In the second equation you apply a frequency shift in the filter band, then you filter the input signal with the modified filter.

**I edited this post after realize my previous answer was wrong.**

Hi jmarcelold,

So if I understand your post correctly... then the normal way to do this frequency shift and filtering would be to perform the frequency shift on the input samples first, and then filter (low pass)?

Do you suspect that the 'spectral leakage' that you mention is the same thing that they reference in the quote? "...residual phase drift..."?

Finally, am I correct in saying that \( w \) an integer multiple of \( 2\pi/Th \) is equivalent to having an integer number of wavelengths of the NCO over the filter length?

Thank you

Yes, Yes and Yes. But I am not so sure that

$$ x(t) \cdot e^{-j w_1 t} * h(t) = x(t) * (h(t) \cdot e^{-j w_1 t} \cdot rect(2\pi/T_h) $$

when \(w_1=2\pi/T_h\),

I may have miss something in my fast analysis. I need to check this.

Go with **Rick Lyons** proposed solution, if you want avoid the conventional solution of first applying frequency shift in the input signal.

Okay... I need to go and do some more digging because now I am under the impression that it is not possible to do this the 'normal' way in our application since we don't know the phase of the incoming signal or something...

I'll be back with more questions if that's alright. I very much appreciate all the responses so far

You don't need to know the phase of your income signal to make a frequency shift on it.

No. They are not equivalent. In

$$x(t) \cdot e^{-j w_1 t} * h(t) $$

frequency shift is applied in the input signal, while in

$$x(t) * (h(t) \cdot e^{-j w_1 t})$$

it is applied in the filter band.

Sorry for my mistake.

Hi,

Thank you for the correction. I'm still waiting to hear from some people about why they thought an unknown incoming phase would be a problem. As you say, it shouldn't be!

Hi.

There is a way to perform frequency translation and FIR filtering simultaneously. The scheme only works if the translation frequency is an integer submultiple of your input data sample rate. And the scheme is only practical if you decimate the output of your filter. If your desired FIR filter has, say, 21 taps, then you'll need to store 21 sets of coefficients where each set contains 21 coefficients. Each set of coefficients are your original FIR coefficients multiplied by various phase-shifted versions of a 21-sample exact full cycle of a cosine wave whose frequency is your translation frequency.

Hi Rick,

Yes we will be decimating the output of the filter. In our application we will likely be sampling ~5MHz of the 8-20MHz band, and then the final output sample rate will be 3.333kHz. There will be several (~4) frequencies of interest (say 10, 12, 13 and 14 MHz or similar) which is the reason for the large sampling band, but the signals are low bandwidth themselves. So far we think a 3 stage decimation is OK.

So are you saying that in order to have one FIR filter of 21 tap length, I need to have 21*21 coefficients? I thought that a 'tap' and a 'coefficient' were the same thing?

Thanks

Hi,

Please forgive my sloppy nomenclature. You are correct, my words "tap" and "coefficient" mean the same thing. And yes, you'll need to store 21*21=441 coefficients in order to use Frerking's technique. Even though your original 21-coefficient FIR filter will be symmetric, I don't think there's a way to reduce that 441 value by a factor of two, but I'd have to think more about that.

Hi Rick,

Thanks - no problem I just wanted to clarify that they were indeed the same. Do you have any references I could look at to learn about /learn how to implement Frerking's technique?

This is for a radar application and our frequencies will be hopping around and only known at run-time, so I'm not sure it will be possible to have integer submultiples of the sampling rate.

Hi Kevin,

I was thinking of scanning the few pages from my copy of Frerking's book that discuss this topic, and sending you that material. But I was lucky. I found Frerking's material regarding that topic at:

I'm thinkin' about trying to implement (model) Frerking's scheme using MATLAB software. Just to see if I can make his method work.

By the way, let me correct an earlier misconception of mine. If your desired FIR filter has, say, 21 taps, then you'll need to store K sets of coefficients where each set contains 21 coefficients. It appears to me that the value of integer K decreases as your decimation factor increases. However, the value of integer K increases as your translation frequency decreases. My my. More study is needed on my part.

[-Rick-]

Hi Rick,

Thanks for the reference. It appears we may have to buy that book as the valid pages are blanked out by google, still - good to know that it is out there!

It will take us some time to digest this new information I think... A lot more study is needed on our part!

Kevin,

Frerking's book is out of print. I'll scan my copy of that book's appropriate pages for you. Send me a private e-mail at:

R_dot_Lyons_@_ieee_dot_org.

I'm working to write my own MATLAB code to implement Frerking's "frequency translating FIR filter."

Hi Kevin,

Regarding the text you quoted in your original post,

"In general the signal(s) of interest are not at baseband, ...",

can you tell from where that quote came? Is that quote from somewhere on the Internet so that I can learn who wrote it and read what else they wrote?

Thanks!!