1.软件版本

MATLAB2021a

2.本算法理论知识

如图GPS系统的星座部分是由21颗工作卫星和3颗在轨备用卫星组成，其高度为20183km，这24颗卫星均匀分布在6个等间隔的、相对轨道面倾角为55º的近圆轨道上。

3.部分核心代码

`clc;clear;close all;%% step1:参数初始化snr           = -7;                %信噪比LEN           = 12000;            %仿真长度fs            = 11.999e6;         %采样频率ts            = 1/fs;             %采样周期n             = fs/1000;   nn            = [0:n-1];      fc            = 3.563e6;        %中心频率fdelta        = 0;                %多普勒频偏svnum         = 1;                %卫星数目N             = 4                 %分段数Nstep         = 20;               %搜索次数%% step2:CA码的产生load gold1.mat;code=double(code(1,:));figure;plot(code,'r-*');axis([0,length(code),-1.2*max(code),1.2*max(code)]);title('采样化后的 CA 码');%相关性Xcor_code = xcorr(code,code);figureplot(Xcor_code,'b-o');axis([0,length(Xcor_code),0,1.2*max(Xcor_code)]);%% step3：GPS中频信号load data.matx=double(data');figure;plot(x,'r-*');axis([0,length(x),-1.2*max(x),1.2*max(x)]);x2 = [x x x x x x x x x x];%发送四段连续的信号；LENS = length(x2);s=0:LENS-1;y=x2.*exp(j*2*pi*(fc+fdelta)/fs*s);y=awgn(y,snr);%% step4：GPS信号的捕获 分成4段捕获CA_fre = conj(fft(code));L2     = length(y)/N;y1 = y(1:11999);y2 = y(12000:23998);y3 = y(23999:35997);y4 = y(35998:47996);y5 = y(47997:59995);y6 = y(59996:71994);y7 = y(71995:83993);y8 = y(83994:95992);y9 = y(95993:107991);y10= y(107992:119990);   ys1 = y1+y2+y3+y4;       for i=1:2*Nstep+1      fc(i)       = 0.0005e6*(i-Nstep-1); %搜索频率          expfreq     = exp(j*2*pi*fc(i)*ts*nn);      Data_sin    = imag(expfreq);          Data_cos    = real(expfreq);      I           = Data_sin.*ys1;      Q           = Data_cos.*ys1;       IQfreq      = fft(I+j*Q);         convIQ      = IQfreq .* CA_fre;      peaks(i,:)  = abs(ifft(convIQ)).^2;end[value_peak codephases]=max(max(peaks));[value_peak frequencys]=max(max(peaks'));frequency = fc(frequencys);%中心频率；codephaseChips = round(1023 - (codephases/11999)*1023);%CA码相位frequencycodephaseChipsclose all;figureplot(peaks(frequencys,:),'r-*');grid onxlabel('频率');ylabel('幅度');%% step5：三围搜索结构gold_rate = 1.023e6;      ts=1/fs;tc=1/gold_rate;b=[1:n];c=ceil((ts*b)/tc); `

4.操作步骤与仿真结论

5.参考文献

[1]李健, 刘峰, 龙腾. 低信噪比下GPS信号P码直接捕获技术[J]. 北京理工大学学报, 2009, 29(1):5.A01-36