How to combine a perfect signal with a limited dynamic range with a poor one with high dynamic range? I have two sensors that measure speed $v(t)$ of a moving vehicle. The first sensor produces a signal $f(t)$ which is a very accurate estimation of speed. However, it only works for slow to moderate speeds and beyond a certain limit, it simply fails to report anything. Let's assume we can model this behavior with an additional output of this sensor using signal $h(t)$, which is $1$ while $f(t)$ is valid and is $0$ when $f(t)$ is invalid. 

Now, the second sensor produces signal $g(t)$ for all speeds but it is not particularly accurate. When $h(t)$ is 1, i.e. when speed is low and the first sensor produces perfect results via $f(t)$, the signal from the second sensor could be modeled as:

Equation 1: $g(t) = \beta_{0}(t) + \beta_{1}(t)v(t) + \epsilon$

The parameters for this linear relationship, $\beta_{0}$ and $\beta_{1}$ are unknown. All we know is that they vary very slowly over time.

So the problem is to estimate $v(t)$ given the 3 signals $f,h,g$.

One solution is of course to forget about $g(t)$ and just report the last value of $f(t)$ when it becomes invalid. Effectively, it means to saturate the output at a certain high speed. 

Alternatively, my initial idea was to use a form of rolling linear regression to estimate the $\beta$ parameters with a fixed window size $w$: When $h(t)$ is $1$, I simply report $f(t)$ and update $\beta_{0}$ and $\beta_{1}$. When it is $0$, I report a $\hat{v}(t)$ estimated using $g(t)$ and the last calculated $\beta$ coefficients. This is obviously very slow since I have to solve a linear regression at each sample. 

Questions:

(1) Does the idea of using rolling linear regression make sense? If yes, how can I do it fast?

(2) Would it be possible to something like a Kalman filter to solve this problem? I'm not sure how to express this problem in a linear state-space model.

(3) I guess the most challenging question would be what to do in the case that $f(t)$ is quantized (e.g. an integer value) while $v(t)$ and $g(t)$ are not. I guess we might be able to simulate it by assuming a uniform distribution for $\epsilon$ in equation 1.
In response to your question (1):

Thinking along the lines of your initial idea, there is a way to avoid regression and do the following approximate procedure instead: 

Without loss of generality, assume that $\epsilon$ has zero mean (if not, then just absorb it into the constant $\beta_0$). Also assume it is i.i.d and has finite variance. Suppose you obtain two sets of data for $(f,g)$ pairs when $h=1$. I will denote these as $\{(f_{1,i}, g_{1,i})\}_{i=1}^N$ and $\{(f_{2,i}, g_{2,i})\}_{i=1}^N$.

Let $\bar{f_1} = \frac{1}{N} \sum_{i=1}^N f_{1,i}$ and similarly define $\bar{g}_1$, $\bar{f}_2$ and $\bar{g}_2$. If $N$ is sufficiently large, we can now claim that, at least approximately, the noise $\epsilon$ can be averaged out and we can write:
$$
\bar{g}_1 \approx \beta_0 + \beta_1 \bar{f_1}
$$
and
$$
\bar{g}_2 \approx \beta_0 + \beta_1 \bar{f_2}.
$$
Now we only need to solve two equations in two unknowns to get the scale parameter $\beta_1$ and offset $\beta_0$, provided $|\bar{f}_1 - \bar{f}_2|&gt;0$.

Of course, whether this will work in your application will depend on whether the variance of $\epsilon$ is small enough (remember: averaging will reduce the variance by a factor of $1/N$), and whether the $f$'s are really noise free when $h=1$.

In response to question (3):

The same procedure should work in case $f$ is a quantized version of the true velocity. The argument here is that quantization introduces a small amount of noise that is approximately uniformly distributed with zero mean. It gets averaged out for large $N$, or so I hope.