function [fc_doppler,ph]=Fn_GPS_Acq_1(fid,fc,fs,svnum,freq_bin,freq_step)
disp 'task for acq and track';
n = fs*0.001;%1个码周期需要多少个时钟
nn=[0:n-1];
ts = 1/fs;
gold_rate=1.023e6;
bit_width=8;
%% 根据需要采用的非相干次数读取所需要的信号长度
times_rr_non_coherent = 1;
[signal,signalsize] = fread(fid,[1,(times_rr_non_coherent+1)*n],'bit8');% 只读取一次的78000个点
%% 频谱图
pwelch(signal);
%% 生成本地码片,并为某些向量预留内存位置
code_local=digitizg(fs/1000,fs,0,svnum,0,gold_rate);
%% 计算搜索频率范围
fc_lo=fc-freq_step*floor(freq_bin/2);
fc_hi=fc+freq_step*floor(freq_bin/2);
freq_max=floor(freq_bin/2)*freq_step;
%% 为部分变量预留内存位置
yy = zeros(freq_bin,n);
rr_non_coherent=zeros(freq_bin,n);
rr_coherent=zeros(freq_bin,n);
%% 开始搜索
for k=0:times_rr_non_coherent
% 选取1ms数据,作为一个基本单元
x2=(signal(k*n+1:k*n+n));
% 去载波,实际是个线性频率搜索的过程
for i =[1:freq_bin]
fr=fc+(i-floor(freq_bin/2))*freq_step;
x_i=x2.*lianghua_bit(cos(2*pi*fr*ts*nn),bit_width)/2^bit_width;
x_q=x2.*lianghua_bit(sin(2*pi*fr*ts*nn),bit_width)/2^bit_width;
x_sinc_i= x_i;
x_sinc_q= x_q;
% 把两路IQ信号,合成一个复数信号
x_iq=(x_sinc_i+1i*x_sinc_q)/2^2;
% 本地CA fft
lcf=fft(code_local)/2^bit_width;
% 数据fft
x_fft=fft(x_iq)/2^bit_width;
% fft相乘
ca_sig_fft_multi=((lcf).* conj(x_fft));
% 最后ifft存放结果在yy里面
yy(i,1:end)=ifft(ca_sig_fft_multi)/2^(bit_width+1);
end
% wl--相干累加和非相干累加
rr_non_coherent=rr_non_coherent+abs(yy);%非相干
rr_coherent=rr_coherent+(yy);%相干
end
%%
rr1=abs(rr_non_coherent);
rr2=abs(rr_coherent);
[amp2,mi]=max(max(rr2)); % wl-- max(rr2)为每rr2每列的最大值,[amp2,mi]=max(max(rr2))则输出rr2最大值,以及在哪一列。
[amp1 crw]=max(max(abs(rr1'))); % wl-- 输出rr1的最大值,以及在哪一行。行数也就是多普勒频移。
[amp1 ccn]=max(max(abs(rr1))); % wl-- 输出rr1的最大值,以及在那一列。列数也就是CA码相位。
% % % % % % % % % % % % % % % % % % % %
disp '捕获结果'
% % % % % % % % % % % % % % % % % % % %
cfrq=fc+freq_step*(crw-floor(freq_bin/2)); %cfrq
fc_doppler=cfrq;
ph=n-ccn;
%%
figure;
s=surf(abs(yy));
set(s,'EdgeColor','none','Facecolor','interp');
figure;
plot(rr1(crw,:),'-*');
hold on;
plot(rr2(crw,:),'r--o');
legend('非相干累加','相干')
end
GPS_Acq.rar_GPS_acq_gps acquisition_信号捕获_卫星信号捕获
版权申诉
162 浏览量
2022-07-15
18:51:41
上传
评论 1
收藏 1KB RAR 举报
小波思基
- 粉丝: 72
- 资源: 1万+
最新资源
- 基于Pytorch训练CIRAR10上分类算法.zip
- Pytorch-pytorch深度学习教程之Tensorboard.zip
- 基于C++和Python开发yolov8-face作为人脸检测器dlib作为人脸识别器的人脸考勤系统源码+项目说明.zip
- Pytorch-pytorch深度学习教程之变分自动编码器.zip
- Pytorch-pytorch深度学习教程之神经风格迁移.zip
- Pytorch-pytorch深度学习教程之深度残差网络.zip
- Pytorch-pytorch深度学习教程之循环神经网络.zip
- Pytorch-pytorch深度学习教程之逻辑回归.zip
- Pytorch-pytorch深度学习教程之双向循环网络.zip
- Pytorch-pytorch深度学习教程之卷积神经网络.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈