📄 acquisition.m
字号:
function [amp,ccn,cfrq]=Acquisition(lpfdata, svnum)
% **************initial parameters****************
fs=4.8e+6; % the sampling frq;
ts=1/fs;
fc=30e+3; % the center frq without the Doppler;
Rc=1.023e+6;
AccumPara=1; % the parameter that divides the 1ms; 16 or 8 or 4
AccumTime=1e-3/AccumPara; % the accumulation time interval;
CorrelationLength=AccumTime*fs; % the correlation length for one time;
intodat=2531; % the initial phase
% svnum=1; % the PRN number;
AcquireTime=1; % the total acquisition time for one time, united by 1ms;
% **** start the acquisiton ******************
% ******* the circular correlation method ***************
%*** input the GPS data that have passed through the down convert****
GPSdata=zeros(1,CorrelationLength);
GPSdata=lpfdata(intodat:intodat+CorrelationLength-1); % get CorrelationLength points out of the data stream coming from the LPF,
% started at the point of intodat;
% GPSdata = conj(GPSdata);
gf = fft(GPSdata);
gf = conj(gf);
FreqValue = zeros(21, CorrelationLength);
for i=1:21
fri = fc - 10000 + (i-1)*1000;
lsi = LocalCarrierCodeGen(svnum, CorrelationLength, fri, 0, 0);
lf = fft(lsi);
FreqValue(i,:) = ifft(lf .* gf);
plot(abs(FreqValue(i,:)))
end
[amp crw] = max(max(abs(FreqValue')));
[amp ccn] = max(max(abs(FreqValue)));
pt_init=ccn; % initial point
cfrq = fc - 10000 + (crw-1)*1000;
plot(abs(FreqValue(crw,:)))
amp
ccn
slew=mod(floor(ccn*Rc/fs),1023*2)
cfrq
% *********************************************************
% ************* the time domain correlation method ************
% AccNumPara = 2; % the step of slewing, normalized by sampling point
% AccNum = 4800/AccNumPara; % there are AccNum search bin in the time domain
% CorrValue = zeros(AccNum,AccumPara); % store the correlator value of every search bin
% FreqValue = zeros(AccNum,32); % store the fft result of every search bin
% GPSdata=zeros(1,CorrelationLength);
%
% % ********* for test ****************************************************
% f=zeros(AccNum,32,AcquireTime);
% % ***********************************************************************
% % fc = 0; % test in the mode without carrier
% lsdata = LocalCarrierCodeGen(svnum, 96000, fc, 0,0);
% lsi = zeros(1, CorrelationLength);
%
% for i = 1:AcquireTime
% for t = 1:AccumPara
% % obtain 1/AccumPara(ms)'s sampling data
% GPSdata = lpfdata(intodat+(t-1)*CorrelationLength+4800*(i-1) : intodat+(t-1)*CorrelationLength+4800*(i-1)+CorrelationLength-1);
%
% for s = 1:AccNum
% % generate AccNum's correlator channels' local data
% lsi = lsdata(1+AccNumPara*(s-1)+(t-1)*CorrelationLength+4800*(i-1) : CorrelationLength+AccNumPara*(s-1)+(t-1)*CorrelationLength+4800*(i-1));
% CorrValue(s,t) = sum(lsi .* GPSdata);
% end
% end
% f = fft(CorrValue', 32);
% FreqValue = FreqValue + abs(f');
%
% % ********** for test *******************************************
%
% % f(:,:,i) = fft(CorrValue', 32);
% % plot(abs(f(:,:,i)'))
% % FreqValue = FreqValue + abs(f(:,:,i)');
% % **************************************************************
%
% end
%
% plot(abs(FreqValue))
% [amp ccn] = max(max(abs(FreqValue')));
% [amp crw] = max(max(abs(FreqValue)));
% cfrq = crw;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -