# Moving average and linearization of two piecewise linear systems

I have 2 oversampling ADC's running parallelly, each to process data in a specific range of the input as shown below:

Each ADC can process only half cycle range of a sine wave. Each ADC adds its own gain/offset errors. Input is simultaneously applied to different ADCs. Assume one conversion cycle is 1ms and there are 1000 clock cycles (sampling clock).

If the input is of low frequency occuring completely in ADC-1's range or ADC-2's range for one conversion cycle, compensation the gain/offset errors (o1,g1 or o2,g2) of those ADC's respectively is straightforward.

The problem arises during filtering where I need to (moving)average the output from two ADCs which have a different offset and gain errors associated with them. This is where I am stuck.

For simplicity, the filter can be considered a First order Accumulator, (1/z-1). It just averages the 1000 samples.

Below is what I tried:

Since the values o1,g1 and o2,g2 are linear with the number of clock cycles, I tried to find to find a linear equation for them by the following methods:

Now I got four equations for ADC-1 and four for ADC-2 (by matching the input and output of separate ADC's - after the filter - in the following conditions): (after fixing tstart): Eqs-1:

• o1=a*n+b
• g1=c*n+d

(after fixing tend): Eqs-2

• o1'=p*n+q
• g1=r*n+s

Through which I can correct the following samples occur sequentially in a single conversion cycle:

• n1 samples from ADC-1 (correct using Eqs-1), n2 samples from ADC-2 ;where (n1+n2=1000)
• n3 samples from ADC-2 , n4 samples from ADC-1 (correct using Eqs-2) ;where(n3+n4=1000)

Now, I am stuck what if the following happens: