next up previous contents
Next: In summary Up: Correlation Previous: Correlation as a tool   Contents

Correlation used to extract transients from a signal

Since correlation measures the similarity between signals, we can use it to detect transients. In the next example we suppose that we are working with something similar to an EMG signal sampled at 20 kHz. The signal contains two forms analogous to a motor unit potential and we are trying to detect where they are located. To synthesize the signal, we use the convolution analogously to the way treated in the previous chapter

-->inct = 0.05;
 
-->N = 10000;

-->mup =  - 0.2 * (sin(%pi*[0:127]/128).^4) .* (sin(2*%pi*[0:127]/128));
 
-->discharges = [ 4300 7500];
 
-->rate = zeros(1,N);
 
-->rate(discharges)=1;
 
-->emg = convol (rate, mup);
 
-->emg = emg(1:N);

Now we are going to contaminate the signal with noise

 
-->rand('normal')
 
-->rand('seed',0)

-->emgnoise = emg + 0.08*rand(emg);

The process of extraction implies the use of a template with the shape that we want to detect. In our case, to detect the shape of the `motor unit potential' we use a template which contains the original form. In correlation, both signals must have the same length. To get the correlation of `mup' with `emgnoise' we have to pad the signal with `zeros'. We call `mup2' the shape of the `motor unit potential' padded with zeros.

 
-->mup2 = [mup, zeros(1,N-length(mup))];
 
 
-->correl = corr (mup2,emgnoise,N);

Now we can plot the result

 
-->xsetech([0,0,1,1/3])
 
-->plot2d ((1:N)*inct,emg);
 
-->xsetech([0,1/3,1,1/3])
 
-->plot2d((1:N)*inct,emgnoise);
 
-->xsetech([0,2/3,1,1/3])
 
-->plot2d((1:N)*inct,correl)

And the result is

Figure 9.7: Correlation used to extract transients: the upper trace represents the original trace, the middle trace the signal masked with noise and the lower trace the correlation between the transient and the signal contaminated with noise
\begin{figure}
\epsfbox{figures/corr7.eps}
\end{figure}

Notice that correlation detects fairly well the position of the motor unit potentials even in a noised environment.

Do you get the idea? If we have a template we can locate this shape in the signal even in a noisy environment.


next up previous contents
Next: In summary Up: Correlation Previous: Correlation as a tool   Contents
je 2006-10-13