I want to detect a special shape in my time series and I apply an matched filter using cross-correlation to increase the SNR.
e = conj(fft(shape,2048)); f = fft(signal,2048); g1 = real(ifft(e.*f));
However, when deleting the second half of the FFT results, because of periodicity, then my g2 still has a small complex part and the result is less good in terms of SNR.
_e = e(1:length(e)/2); _f = f(1:length(f)/2); g2 = real(ifft(_e.*_f));
Could you explain me why there remains a complex part in g2? And is there any easy method to improve the signal again after deleting half of the spectrum? Or is not advisable at all to discard the second half?