Global Positioning System Reference
In-Depth Information
% digold.m call cacode
function code2 = digold(n,fs,fd,offset,sat);
% n - number of samples
% fs - sample frequency in Hz;
% offset - delay time in ns second must be equal to or
greater than -2/fs.
% sat
- satellite number;
% fd
- Doppler
gold rate = 1.023e6;
%gold code clock rate in Hz.
f1=1575.42e6;
fs=fs*(f1-fd)/f1;
ts=1/fs;
tc=1/gold rate;
code in = cacode(sat);
offset=offset*f1/(f1-fd);
b = 1:n;
tmp=(ts*b+offset);
if(tmp(1)<0)
tmp(1)=1023*tc;
tmp(2)=ts;
end
c = ceil(tmp/tc);
c=rem((c-1),1023)+1;
code2 =code in(c);
Search WWH ::




Custom Search