I am trying to simulate the data transmission of a GPS satellite. Telecommunications is not my field so I am struggling a bit with some concepts. I managed to generate the Gold code of the GPS transmitter using shift registers. This creates a pseudorandom 1023-vector with [-1 1] values. Now I want to create a sampled version of this signal up to 5.714Hz assuming the clock of the codes work at 1.023 Mchip/s and then modulate this signal with a sinusoidal carrier of 4.309 MHz sampled at the same frequency. I am not sure how to sample the signal. From what I've understood, I wrote something like this in Matlab but it's not right :
a = [1 1 1 1 1 1 1 1 1 1 ]
b = [1 1 1 1 1 1 1 1 1 1 ]
for k = 1: 1023
A(k) = a(10) ;
B(k) = mod(b(2)+b(6),2) ;
C_A(k) = mod(A(j)+B(j),2) ;
Af = mod(a(3)+a(10),2) ;
Bf = mod(b(2)+b(3)+b(6)+b(8)+b(9)+b(10),2) ;
% shifting
sg_1 = [ Af a(1:n-1) ] ;
sg_2 = [ Bf b(1:n-1) ] ;
end
code_vect = (C_A-0.5)*2 ;
% UP TO HERE IT'S OK, I GOT THE C/A CODE, how to modulate it?
code_vect = code_vect(index,:) % this is 1x1023 Gold code vector
sa_fq = 5.714e6 %sampling freq
ca_fq = 4.309e6 %carrier freq
cd_fq = 1.023e6 %code frequency (I am right?)
clk = 1.023e6 %clock rate
time = 1/sa_fq : 1/sa_fq :1023/sa_fq %time vector
for i = 1:1023
%sampled signal, I'm sure this is wrong but don't know how to do it
code_vect_sa((ceil(sa_fq)*i)-(ceil(sa_fq)-1):(ceil(sa_fq)*i))=code_vect(i)*ones(1,ceil(sa_fq))
end
carr = cos(2*pi*(ca_fq+cd_fq)*time) %carrier
sig_mod = code_vect_sa*carr ; modulated signal
Can you guys give a hint on how to solve it. Thanks in advance