I have a quadrature detector, which provides I and Q baseband signals with 4 kHz bandwidth, set by detector's LPF. I digitiize them on two ADCs with sampling frequency 48 kHz, make Hilbert transformation in time domain by IIR filter, then add or subtract them to get lower or upper side band. That all works fine.

Now I have ONE ADC, which digitizes the same I and Q signals in sequence, i.e. every even sample is I, every odd sample is Q. It means that each I and Q signal is sampled at 24 kHz. I still want to apply the same Hilbert approach above. But now I and Q signals are shifted by one sampling interval. Few questions:

1. Since sampling frequency 24 kHz is much higher than baseband bandwidth 4 kHz, can I ignore that shift ? How low can I decrease the sampling frequency: 16 kHz maybe ? But not 8 kHz, that's probably too close to 4 kHz. What is the lowest sampling frequency, which still allowes to ignore I and Q time shift for Hilbert transform?

2. Another approach is to upsample both I and Q signals by a factor of 2. Then they become both "sampled" at the same time moments at 48 kHz. Above mentioned Hilbert approach can be applied. According to Rick Lyons "Understanding Digital Signal Processing", the sampled data must be zero-stuffed and Low-Pass Filter applied. That seems way to complex for my case of the factor of 2. I interpolated the missing samples by the linear interpolation of the previous and the next samples (which were really measured by ADC). Questions are:

• how bad my linear interpolation approach is, compare to zero-stuffing and LPF ? Probably it depends on sampling frequency.
• is there any mathematical proof that zero-stuffing and LPF technique in corner case of factor 2 interpolation, and probably 4 kHz << 48 kHz, is equivalent to the linear interpolation one?
• Jun 12 at 19:44

The sampling offset is a time delay between the I and Q paths. The Fourier Transform of a time delay $$T$$ is $$e^{-j\omega T}$$ and thus we see that this will impart a linear phase that is proportional to frequency (and knowing $$T$$ and our frequencies of interest, we know exactly what this phase is). In contrast to the Hilbert Transform, which has a constant quadrature phase across all frequencies, the phase due to the time offset is varying linearly over frequency. If the sampling rate is high enough, and the signal bandwidth and spectral occupancy low enough, the phase may be insignificant and can be ignored, but in most practical cases where we are not significantly oversampling the signal, this added delay must be compensated for. This is easily done with digital techniques such as Pade approximations, farrow filters, polyphase filters etc.

Question 1:

In this case of the 48 KHz sampling with every other sample selecting either I or Q from the quadrature detector, we note that the time offset between the I and Q paths with each sampled at 24 KHz is 1/48 KHz, and given the Fourier relationship above, this would impart a phase error from true quadrature proportional to frequency as given by $$2 \pi f/48e3$$. The 4 KHz component of the waveform would therefore have a phase error of $$2\pi 4/48 = 0.52$$ radians. This would lead to a significant sideband error (0.52 radians is no longer small angle, but for small angles the relationship between quadrature error and sideband suppression is $$20log_{10}(\phi/2)$$.) A chart showing the sideband level versus phase and amplitude error is available here, where we see that 0.52 radians (or 29.8 degrees) is far off the chart; meaning unacceptable quadrature error.

Question 2:

Zero stuffing replicates the spectrum without introducing any other distortion within the bandwidth of the original spectrum, but adds spectral distortion out of the bandwidth through spectral images. For an upsampling by two of a 24 KHz waveform with a 4 KHz signal bandwidth - we would get the following spectrum from the zero-stuffing prior to subsequent interpolation filtering:

The upper spectrum is the original spectrum for each I or Q path sampled at 24 KHz, out to the Nyquist frequency of $$f_s/2 = 24$$ KHz. The lower spectrum shows the spectral replication that occurs due to the zero-stuffing: the Nyquist frequency extends out to twice the original or 24 KHz, but now an image of the original spectrum exists right near the Nyquist boundary. The "perfect" interpolation filter would pass the desired spectrum out to 4KHz with no distortion and completely eliminate the image. Such "perfect" filters are not possible to implement, but we can constrain the filter complexity based on the allowable distortion we can accept.

Using linear interpolation to replace the zeros is identical to using an FIR filter with coefficients given as [0.5, 1, 0.5]. The frequency response for this filter is shown below:

This filter adds about 0.7 dB of passband droop at 4 KHz, and attenuates the image starting at 20 KHz by 24 dB, with increasing attenuation after that.

In comparison below I show what can be achieved with a simple halfband FIR filter using the least-squares algorithm for minimum error in the 0 to 4 KHz passband and maximum rejection in the 20 KHz to 24 KHz rejection band. I designed the filter for 7 taps, but as we'll see further below this ends up being an interpolator using 2 pairs of adjacent samples instead of 1 pair as the OP is doing with the linear interpolator. Here we see for comparison to the linear interpolator how we can get greater than 50 dB rejection at the starting boundary of the image spectrum for this case.

The normalized coefficients for this filter are:

h[0] = h[6] = -0.07454
h[1] = h[5] = 0
h[2] = h[4] = 0.57329
h[3] = 1


So for a 7 sample buffer with samples numbered 0 through 6; add samples 0 and 6 together and multiply by -0.07454, add that to the sum of samples 2 and 4 multiplied by 0.57329, and add that to sample 3. Since the buffer will have alternating zeros from the stuffing, what ends up happening in the operation as a filter is that when the filter is centered on a non-zero value, all the other coefficients will be zero'd and only that one value is selected (as we would want), and when the filter is centered on a zero'd value (as in the sketch below) the interpolated sample is found from just two sums and two products of the two adjacent non-zero samples on each side.

I used the notation $$x_{-1}$$ to indicate the first earlier sample and $$x_{+1}$$ for the first later sample, relative to the zero being replaced with an interpolated value.

This quantifies what that distortion would be for the OP's case between a simple linear interpolation versus a more sophisticated filter, and I have provided an example filter that could alternatively be used with significantly better rejection of the image distortion and significantly less passband droop, with the added complexity of using 2 adjacent samples on each side instead of one. Which way to go depends on the requirements for what level of distortion would be acceptable.

It was asked in the comments how a CIC would compare so I also included the frequency responses for a 1 section CIC (or first order CIC) as "CIC", and cascaded CICs as "CIC^2", "CIC^3", and "CIC^5". A 2 section (second order) CIC would have the same frequency response as the linear interpolator the OP suggested. Order is increased by simply including additional "combs" and "integrator" stages as diagramed below for an Nth order CIC (CIC^N):

In order to get greater than 50 dB rejection (for comparison to the improved interpolator I provided), a 5 section (fifth order) CIC would be needed. I didn't show the fourth order case; this one would have -47 dB rejection at the 20 KHz edge of the image location. But also note the significant increase in passband droop from DC to 4 KHz that the CIC filter would give. The passband droop if an issue can easily be compensated with an additional 3 tap FIR filter, but at this point the solution isn't nearly as simple compared to the enhanced interpolator based on a halfband FIR filter, especially if you are working with a fixed point implementation as a higher order CIC will easily introduce overflow errors if precision isn't carefully managed.

• Thanks! Does CIC filter make sense here? Also with lower sampling frequency 16 kHz, spectrum on the first picture just compresses, while other pictures stay. Jun 16 at 5:41
• They both equally compress with sampling rate, but your bandwidth (out to 4 KHz) doesn't compress, so the rejection will suffer. I designed the second filter specifically with the higher sampling rate but would be easy to design at the lower rate as well to optimize the performance with the same type of implementation. This is a standard "half-band filter" commonly used for resampling such as this. CIC is also an option but I don't think it would be a better choice in this case. It would introduce pass band droop and a single stage wouldn't be sufficient compared to the later approach I show Jun 16 at 13:14
• I will add the responses for CIC. A multi-stage CIC isn't a big deal to implement but I wouldn't consider it simpler. The CIC^2 is exactly the same frequency response as your 2 sample interpolator. Jun 16 at 13:14
• Is it even possible to run ADC at full sampling rate 16 kHz: each I and Q channels will be sampled at 8 kHz, with zero-stuffing the spectral replicates will be centered at 8 kHz, touching baseband spectra at 4 kHz (am I right, compressing your first picture?). There is almost no attenuation at frequencies adjacent to 4kHz. Jun 16 at 18:21
• @K-man No as in this case there is no room for a filter transition between the desired passband and the image- so you will have significant and unavoidable distortion near this boundary (unless you don’t actually need bandwidth out to 4 KHz). A good rule of thumb is to set the maximum bandwidth at 70 to 80% or the sampling boundary and deviating from that just makes the filtering more challenging the closer you get to the edge. So using that guidance rhe recommended min sampling rate for interp by 2 would be 10KHz using my 80% guidance. Jun 16 at 18:38

If you are sampling at 24kHz and each of I and Q are be limited to 4kHz, the effect of one sample offset should be limited. If you want to reduce it further, perhaps you could do a simple linear interpolation between neighbour samples?

Q_hat(n) = [Q(n-1)+Q(n+1)]/2

where «n» is the full-rate sample index, and Q_hat is an estimate for the (missing) Q stream perfectly alligned with the I stream.

• Can I use this technique with sampling frequency 16 kHz, 8 kHz ? It must be some low limit. Jun 11 at 4:18
• I guess that the limit is Nyquist. If each channel is limited to <4kHz BW then they need to be sampled at 8kHz or more. Thus a muxed ADC needs to operate at 16kHz or more. As a properly sampled signal retains all information, it follows that processing can bring out intermediate samples. The closer to the Nyquist limit you operate, the more careful you need to be with that processing (using something like a windowed sinc filter). Either sample at a high rate and do crude processing, or at a lower rate and do sophisticated processing. Jun 11 at 4:32
• In other words: "sample at a high rate and do" linear interpolation, "or at a lower rate and do" zero-stuffing with LPF ? Jun 11 at 4:56
• Yes. Linear interpolation is zero-stuffing with a (triangular) LPF. It just happens to be simple to implement and have crude filtering specs compared to longer, more elaborate filter kernels Jun 11 at 5:13
• Investigating zero-stuffing with LPF (at a lower rate), I found that LPF can be CIC filter. It is pretty simple for upsampling by 2: y(n)=x(n)-x(n-2)+y(n-1) not heavier than linear interpolation above. Benefit is: operate at a lower sampling rate. Does it make sense? Jun 13 at 5:56