function [v,t] = centermatch(signal, match, times)

if(nargin < 3) 
    times = 1:length(signal);
end

l = length(match) + length(signal) - 1;
m = 2^(ceil(log(l)/log(2)));
match = match(length(match):-1:1);
matched = real(ifft(fft(signal,m).*fft(match,m)));
%matched = conv(signal,match);
s1 = ceil(length(match)/2);
s2 = length(signal) + s1 - 1;

v = matched(s1:s2)/sum(abs(match).^1);
t = times;