1
$\begingroup$

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));

cross-correlation

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?

$\endgroup$
3
$\begingroup$

If the input signal is real-valued, then the DFT returns a sequence of length $N$ that satisfies $$X[N-n]=X^*[n]$$

As one usually plots the magnitude of the spectrum, then the relationship of interest is:

$$|X[N-n]|=|X^*[n]|\implies|X[N-n]|=|X[n]|$$

When you work with real-valued signals, one tends to "ignore" the second half of the FFT spectrum due to this symmetry property.

However, if the signal is complex, then both sides of the spectrum are fundamental, as the symmetry is not accomplished anymore. When you call the function ifft after discarding one side of the spectrum, the function is assuming that the original FFT (the input) is non-symmetrical (as you deleted one half of it), so the time-domain sequence from which it came from must be complex. That's why you get a complex-valued signal when coming back to the time-domain.

$\endgroup$
  • $\begingroup$ thanks, this completely anwers my question. Now I understand that I cannot discard the second half because it is not "redundant" when I'm in complex domain. Further question, so my signal g2 is just missing the complex part and has therefore different values? $\endgroup$ – schtz Jan 11 '18 at 14:05
  • $\begingroup$ It's not missing the complex part, it's its spectrum that just lacks one half of information. Don't discard it when you want to come back to the time-domain via IFFT. $\endgroup$ – Tendero Jan 11 '18 at 14:10
  • $\begingroup$ Okay understood. If I don't need to have the exact time-domain values afterwards, but only the shape and peaks are of interest, then would it be theoretically possible to discard it? Or do I miss important information? I'm asking because g2has at least the same shape as g1 and is only using its real values. $\endgroup$ – schtz Jan 11 '18 at 14:17
  • $\begingroup$ I think it really depends on your signals, because when you cut the spectrum you are not only losing the symmetry but also chaning the length of the sequence by a half. Maybe someone could provide a more generic answer, but I don't feel confident proposing a general "yes" or "no" answer to your last question without knowing what the signals are. Maybe you could post a different question asking that exact thing, and stating what the signals of interest are. $\endgroup$ – Tendero Jan 11 '18 at 14:25
  • $\begingroup$ g1 and g2 will only be the same if they are perfectly symmetric waveforms. If your time domain waveform is anti-symmetric, then g1 and g2 will be completely different. $\endgroup$ – hotpaw2 Jan 11 '18 at 23:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.