update detect.m to matlab convolution