# Detecting a frequency pattern in the frequency domain

I am looking to detect a combination of frequencies in the frequency domain. For example, here is my spectrum:

And I'm trying to detect the pilot tone. I have the FFT of the pilot tone:

which zoomed in looks like this:

I tried doing a cross-correlation in matlab:

trainingfft = fft(trainingfreq);
datafft = fft(idat);
Hxcorr = dsp.Crosscorrelator;
CorrResult = step(Hxcorr,datafft,trainingfft);


But ended up with this:

I really am looking to detect the presence of the three peaks anywhere in the spectrum. I think the cross correlation isn't working because of the presence of the noise floor, so I was thinking about using some kind of threshold checker to clean up the noise but really am looking for an elegant solution.

Is there an elegant way of doing this?

• Did you try normalized cross correlation, normxcorr2 ? Jan 7 '14 at 9:23
• I'm looking at it now, it seems to be 2D cross-correlation for images?
– user1529
Jan 7 '14 at 9:25
• Did you make sure that the signals trainingfft and datafft have the same frequency resolution?
– Deve
Jan 7 '14 at 9:42
• @Deve: It's possible they're not the same resolution, I'm going to put together a test case to check.
– user1529
Jan 7 '14 at 14:45
• You're visualizing your data in a sort of bizarre way; it makes no sense to plot a logarithmic plot of the amplitudes in the frequency domain when a correlative search is inherently looking at things in a linear (with regard to amplitude) manner. Also, your first plot looks like it has virtually no noise in it at all; the two main peaks are a full 55 dB higher than the noise floor, meaning that when plotted normally, the noise should be virtually invisible. As Deve said, it's crucial that the pilot tone and the spectrum have the same frequency axes, not just the same number of datapoints. Jan 17 '14 at 3:46

xcorr(trainingfft,datafft,'option')