# Correlating a sequence or a code with itself at QPSK symbol rate

I am sending a QPSK signal that represents a certain sequence or code and that needs to be correlated with itself on the receiver (there are other sequences/codes in the system, and they are all orthogonal). The result of the correlation should indicate which code was sent . Suppose an AWGN channel, and at the output of the I and Q matched filters on the receiver I have one sample/symbol that is a 'sufficient statistic" , so one sample on I and one sample on Q , and suppose timing synchronization is perfect and no other impairments besides AWGN (SNR is high enough), my question is the following: Can correlation take place at the symbol rate ? or does one need more than one complex sample/ symbol in order to do the correlation?

• It is unclear to me what the problem is. You can correlate any two sequences. Do you need it to happen in real time? – MBaz Sep 21 '18 at 1:12
• What I am asking is one sample /symbol enough for correlation? – Hatem Tawfik Sep 21 '18 at 15:37

The answer is yes, absolutely 1 sample per symbol is sufficient if your symbol timing and frequency offsets are sufficiently accurate (they need not be perfect).

Regarding frequency accuracy: The magnitude of correlation vs frequency offset is a Sinc function with first null at 1/T where T is the length of the sequence being correlated.

I started to develop this point in another recent post (Derivation of the Optimal Matched Filter - Convolution vs. Correlation) showing the first three samples of a correlation when a frequency offset exists. The results in this post showing correlation without a frequency offset should make it very clear why 1 sample (the correct sample) per symbol is sufficient. In the plot we see the resulting Sinc response of correlation vs frequency offset with the first null at 1/T = 1 Hz. If we needed a wider tolerance to frequency offset, we could easily correlation over 100 samples in the case to then push the null out to 1/.1 = 10 Hz. Of course we would lose 10 dB in processing gain (see prior post referenced) so we see the trade of SNR needed versus the frequency inaccuracy that can be tolerated. This next graphic continues that example to show the case of a correlation over 1000 samples vs frequency offset when the sampling rate is 1 KHz. This means that T = 1 second in this case, and we see that if we considered correlating a 3 Hz signal to a 4 Hz signal, that after summing 1000 products, the summation will be back at the origin (correlation null). The exact relationship for the correlation versus timing offset depends very much on the pulse shape of each chip in your signal (the change in magnitude for each sample due to timing offset), and the concern therefore would be both with a timing offset in time, and a timing offset in frequency (this is different from the frequency offset above in that an offset in frequency of the timing clock will cause it's sample position within the symbol to roll, while a frequency offset in the carrier will cause the complex IQ correlation to rotate on the IQ plane.).

Both cases are easily computed by knowing that correlation is a sum of products, and correlation sequences typically have the same number of 1's and 0's (or close to the same number, often they are an odd number so in that case would have one greater 1 than 0 or vice versa).

just as a simple example.

let's say we want to find the sequence h in data

let's make

h = [ 1 2 3 4 5 ];


now we got data with h in it and we want to find where h starts

let's make data

data = [ 0 0 0 0 0 1 2 3 4 5 0 0 0 0 0 0 0 0 0 0];


to find where h is we can use convn

hfind = conj(  h(end:-1:1)  );

hdetect = convn(data,hfind,'same');

[maxnumber,index] = max(abs(hdetect));


index will be 8

so h starts at index - (5/2) = 8 - 2 so h starts at sample 6 in the data set hope this helps