资源简介
关于GPS信号如何产生、如何捕获、如何追踪的所有matlab程序大集合!
代码片段和文件信息
function [correlation codePhase]= acquisition(datachipratesamplingFreqIFsamplesPerCode)
% performs a circular convolution by using the FFT and IFFT .
% Generate CA code
CA_code = makeCaTable(181023chipratesamplingFreq);
CA_double = [CA_code CA_code];
CA = CA_double(10001:48192);
% time vector/矢量,向量
t = (0:(samplesPerCode-1))/samplingFreq;
% In-phase component
I_comp = cos(2*pi*IF.*t).*data;
% quadrature component
Q_comp = sin(2*pi*IF.*t).*data;
% FFT of I and Q comps
X = fft(I_comp + i*Q_comp);
% conj(FFT) of CA code
F_CA = conj(fft(CA));
% Multiply in freq domain and perform IFFT
% then get the squared magnitude
correlation = abs(ifft(X.*F_CA)).^2;
settings.acqThreshold = 2.5;
%% Look for correlation peaks in the results ==============================
% Find the highest peak and compare it to the second highest peak
% The second peak is chosen not closer than 1 chip to the highest peak
%--- Find code phase of the same correlation peak ---------------------
[peakSize codePhase] = max(correlation);
%--- Find 1 chip wide C/A code phase exclude range around the peak ----
samplesPerCodeChip = round(samplingFreq / chiprate);%38
excludeRangeIndex1 = codePhase - samplesPerCodeChip;
excludeRangeIndex2 = codePhase + samplesPerCodeChip;
%--- Correct C/A code phase exclude range if the range includes array
%boundaries
if excludeRangeIndex1 < 2
codePhaseRange = excludeRangeIndex2 : ...
(samplesPerCode + excludeRangeIndex1);
%samplesPerCode是38192,不要与samplesPerCodeChip混了,
%这排除了不可能的码区间
elseif excludeRangeIndex2 >= samplesPerCode
codePhaseRange = (excludeRangeIndex2 - samplesPerCode) : ...
excludeRangeIndex1;
else
codePhaseRange = [1:excludeRangeIndex1 ...
excludeRangeIndex2 : samplesPerCode];
end
%--- Find the second highest correlation peak in the same freq. bin ---
secondPeakSize = max(correlation( codePhaseRange));
%注意这个是codePhaseRange,在相位区间之外
%--- Store result -----------------------------------------------------
acqResults.peakMetric = peakSize/secondPeakSize;
% If the result is above threshold then there is a signal ...
if (peakSize/secondPeakSize) > settings.acqThreshold
fprintf(‘捕获成功‘)
else
fprintf(‘捕获失败‘)
end
end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2543 2012-12-22 09:42 acquisition.m
文件 2347 2011-05-23 19:26 cacode.m
文件 503 2011-05-23 19:21 calcLoopCoef.m
文件 1219 2013-03-25 10:30 main.m
文件 1805 2012-12-22 20:14 makeCaTable.m
文件 6804 2011-05-24 09:36 test.m
文件 6787 2011-05-31 15:53 tracking.m
评论
共有 条评论