Adaptive filter to scale and phase shift two sensors output One way of separating downgoing and upgoing wavefields in offshore seimic processing is to add signals from hydrophone and vertical component of the geophone (they are co-located). Hydrophone only registers a change in the pressure whereas geohphone as well as registering a change in seismic field also reacts to the direction of arriving wave, ie. if it is coming from above or below (sensors are deployed on sea floor). But the scale of the two are different as they record two different physical quantities. In addition, there is a phase difference between the two. To do the summation, I first need to re-scale one to the other and phase shift. The phase shift is slightly frequency dependent. I would like to make a filter that does the above on a period of data and then use the filter on all incoming data. The figure below shows an example of an upcoming signal (hydrophone signal has been downscaled for the exmple. In reality it is of much higher amplitude). If the two were of same scale and in phase then summing them will double the signal's amplitude while reducing the noise coming from above. I have some solution in time domain (assuming constant phase shift and scaling factor) and frequency domain by multiplying one's spectra with the transfer function between the two (found from spectral division). I have also used 'nlms' adaptive filtering. But some noise still remains, enough to make trouble later on.
Wonder if anyone has a suggestion on how to make the filter or some Matlab code.
Thanks
It seems that you want to equalize one time series to the other or vice versa or some combination. The general problem is then (in shorthand)
$$
h_1{\Large *}y_1 \approx h_2{\Large *}y_2
$$
where $\Large *$ denotes convolution, $h_i$ are filters, and $y_i$ are your time series. If you simply equalize one time series to the other, this is
$$
y_1 \approx h_2{\Large *} y_2
$$

In matrix form, this becomes
$$
\left[\begin{array}{c} y_1[p]\\y_1[p+1]\\\vdots\\y_1[p+N-1]\end{array}\right] \approx
\left[\begin{array}{cccc}y_2[2p] &amp; y_2[2p-1] &amp; \cdots &amp; y_2[0]\\
y_2[2p+1] &amp; y_2[2p] &amp; \cdots &amp; y_2[1]\\
\vdots &amp; \ddots &amp; \ddots &amp; \vdots \\
y_2[2p+N-1] &amp; y_2[2p+N-2] &amp; \cdots &amp; y_2[N-1]
\end{array}\right]
\left[\begin{array}{c}h_2[0]\\h_2[1]\\\vdots\\h_2[2p] \end{array}\right]  
$$
or more concisely
$$
\underline{y}_1 \approx {\bf Y_2}\underline{h}_2
$$
The least squares solution for the equalizing filter coefficient vector is 
$$
\underline{h}_{2,LS} = \left({\bf Y_2^HY_2}\right)^{-1}{\bf Y_2^H}\underline{y}_1
$$

You can alternatively use LMS or RLS to do recursive updates to find/track $\underline{h}_2$.

One additional comment on equalizing one time series to the other: by choosing to equalize $\underline{y}_2$ to $\underline{y}_1$, we choose one spectral weighting - implicitly. If we instead equalized $\underline{y}_1$ to $\underline{y}_2$, we would have a slightly different spectral weight for the overall least squares fit. If the filters are relatively minor in magnitude variation over the signal band, the spectral weight difference is similarly minor, but if the equalizer filter response is quite different for the two cases (can just as well solve and analyze both), you will need to assess which is preferred/better and why.