Hi all,

I want to correlate two signals one of them is constant (locally generated) code and other signal is circular (repeating the first code periodically) which sampled in Fs and phase shifted version of first signal. In Matlab for example first signal (1.023 MHz) is 1023 bytes long  in 1 ms (locally generated constant code) and second signal sampled at Fs (for example 16.368 MHz) is 16368 bytes long in 1 ms. There should be 16 sample for each code chip so for correlation constant code chips firstly replicated 16 times to reach 16368 byte. And below operations made by us to find phase.  

 

ts = 1 / 16368000;

samplesPerCode = 16;

tc = 1 /1023000;

 

codeValueIndex = ceil(((1 / ts) * (1:samplesPerCode)) / tc);

codeValueIndex(end) = 1023;

code = codeNotRep(codeValueIndex); %code replicated to reach 1ms sampled data size

 

codeFreqDom = conj(fft(code));      %constant periodic code’s fft and conjugate    

IQfreqDom1 = fft(IQCompData1);      %incoming signal (periaodically repeats code but selected may be phase shifted)

convCodeIQ1 = IQfreqDom1 .* codeFreqDom; %correlation

acqRes1 = abs(ifft(convCodeIQ1)) .^ 2;    %enery distributon to find phase

 

When I examined Matlab’s help It says if data is not power of two Matlab does DFT instead of FFT (our data is 16368 byte which is not power of two). But TEXAS C64X library has power of two FFT library and so if I make zero padding to constant code and incoming signal  to align 16384 byte (power of 2) my codes circular property disappears and correlation energy decreases.

 

Do you have any idea how can I get rid of zero padding bad affect ?  How can I convert Matlab’s FFT function to “C” language to use at our TEXAS C64X processor?

 

Thanks for help.