I'm trying to transmit and receiver the GPS payload in both Time and Frequency Domain.
For transmitting and receiving in time domain :
numBits = 10; % LFSR length
codeLength = 2^numBits-1; % Spreading code length
payload1 = 1*(rand(1,100)>0.5);
payload2 = 1*(rand(1,100)>0.5);
payload3 = 1*(rand(1,100)>0.5);
payload1 = 2*payload1 - 1; %BPSK Modulation
payload2 = 2*payload2 - 1; %BPSK Modulation
payload3 = 2*payload3 - 1; %BPSK Modulation
% payload1 = ones(1,10);
% payload2 = ones(1,10)*2;
% payload3 = ones(1,10)*3;
%% PN code generation
% initial sequence is taken from IRNSS document
goldCode1 = generateGoldCode(935,239,codeLength,numBits);
goldCode1 = 2*goldCode1-1; % Assign code to 1 to 1 and -1 to 0
goldCode2 = generateGoldCode(38,381,codeLength,numBits);
goldCode2 = 2*goldCode2-1;
goldCode3 = generateGoldCode(564,561,codeLength,numBits);
goldCode3 = 2*goldCode3-1;
%% At transmitter part
payloadData1 = kron(payload1,goldCode1); % Product of payload data and gold code to spread the sequence
payloadData2 = kron(payload2,goldCode2);
payloadData3 = kron(payload3,goldCode3);
TxData = (payloadData1 + payloadData2 + payloadData3);
%% At receiver part
%% Time Domain
crossCorr = xcorr2(TxData,goldCode2);
outputData = crossCorr(codeLength:codeLength:end)/codeLength;
For Frequency domain I want to receive each bit at a time:
starting =1;
i=0;
crossCorr_temp=[zeros(1,100)] ;
goldCodeFFT = conj(fft(goldCode2));
for val = 1023:1023:length(TxData)
payloadFFT = fft(TxData(starting:val));
crossCorr_FFT = ifft(payloadFFT .*goldCodeFFT);
corr_time = crossCorr_FFT(1:end)/codeLength; **#Doubt here**
starting = starting +1023;
i=i+1;
end
How do I approach this frequency-domain way to receive the GPS payload bits?