# Implementing a Matlab filter to cancel cross talk between two sensors

I have two sensors that have a cross talk between them. I would like to cancel the cross talk. For this I recorded two tracks, where sensor no.1 (called x1) has some input, and sensor no.2 (called x2) is zero.

I was told to make the following operations:

Since your cross talk is small:

1) Simply measure the transfer function $H_{ba}(\omega)$ directly.

2) Subtract it out as follows:

2.1) Measure the transfer function from signal A to sensor B when signal B is 0.

2.2) Create a filter from this transfer function (FIR or IIR, depending on it's shape).

2.3) Now you can measure and subtract a filtered version from sensor signal A from sensor signal B:

$y_b'(t) = y_b(t)-h_{ab}(t)*y_a(t)$. Where $h_{ab}(t)$ is the impulse response of your cross talk filter and $*$ the convolution operator.

Here is a Matlab code that I wrote for this purpose, but its performance is really bad. If someone has a suggestion what I did wrong, or can suggest a new code I will be grateful. If I may say, a friend helped me to implement this, and I think that we did not implement the filter part, but maybe I am wrong.

% The files designated to measure the transfer function.
% x1 has some input. x2 is is zero, and affected by the x1.

%The transfer function.

Hab = fft(x2)./fft(x1);

hab=ifft(Hab);

% Some new tracks, where x3 is recorded from sensor no.1 and x4 from sensor no.2.
% All the files have the same length.

c=conv(hab,x3);

% Subtracted signal

x4 = x4 - c(1:length(x4));


The following code did not subtract the cross talk on x4. Here are some images explaining the problem. For some frequencies the above code actually did a good job and subtracted the cross talk, and for some it did the opposite and increased the energy. plot(abs(fft(x4))):

Good - Frequency energy subtracted:

Bad - Frequency energy increased (!):

Thank you!

• See this question to understand why $$Hab = fft(x2)./fft(x1); hab=ifft(Hab);$$ is a bad idea. – Dilip Sarwate Dec 16 '11 at 17:24
• @DilipSarwate Thanks for the comment. I would like to hear your idea how to change it. – user1017064 Dec 16 '11 at 18:13
• By reading the link more deeply I understand that the above solution is incorrect... If someone can help me to implement the right filter I will be so thankful. – user1017064 Dec 16 '11 at 20:43
• It would be best if you could modify the sensors themselves to eliminate crosstalk. If not, something like ICA might help? dsp.stackexchange.com/q/812/29 – endolith Dec 16 '11 at 22:42
• I have already tried ICA and it doesn't work for me.. – user1017064 Dec 17 '11 at 10:26