核心提示:MATLAB代做|FPGA代做|--GPS相关检测源码程序...
clc;
clear;
close all;
load fdcorr_demo.mat
% loads three variables to the workspace:
%
% prn_code: This is the Gold Code for GPS Satellite SV26
% rx_seg: This is an actual GPS signal captured on
% Saturday 4/7/2007 at 1:35 PM in Chelmsford, MA
% and downconverted to (nearly) baseband.
%
% Both sequences are sampled at Chip2x (2.046 MHz) and
% 1023 chips long (one GPS PN sequence length).
%
% frange: This sets the frequency search range for fdcorr
fs= 2*1.023e6; % sampling rate (used to determine freq offset in Hz)
[fdout, freq_axis]= fdcorr(rx_seg,prn_code,frange);
%find delay and frequency offset for SV26:
[temp1, temp2]=max(fdout); %max in each col of fdout
[maxcorr,freq_index]=max(temp1);
delay=temp2(freq_index)-1;
chip_delay=(delay)/2; %in chips since sampled at chip2x
freq= freq_axis(freq_index); % in radians/sample
freqHz= freq*fs/(2*pi); % in Hz
%run again without a return variable to plot result:
figure(1)
fdcorr(rx_seg,prn_code,frange);
%correct course frequency offset:
rotation=[1:length(rx_seg)]'*freq;
rx0= rx_seg.*exp(-j.*rotation);
%align code with signal
codeshift=circshift(prn_code,-delay);
%correlation at aligned frequency and delay:
svcorr= abs(rx0'*codeshift);
%plot aligned result:
figure(2)
fdcorr(rx0,codeshift,frange);

联系:highspeedlogic
QQ :1224848052
微信:HuangL1121
邮箱:1224848052@qq.com
微信扫一扫: