m基于matlab的GPS卫星信号捕获和数据解析仿真

news/2024/5/9 6:14:51/文章来源:https://blog.csdn.net/hlayumi1234567/article/details/127325016

目录

1.算法概述

2.部分程序

3.算法部分仿真结果图

4.完整程序获取


1.算法概述

       全球定位系统(gps)是一种全天候、全球覆盖、高精度、自动化的卫星导航定位系统,该系统向有适当接收设备的全球范围用户提供精确、连续的三维位置和速度信息。gps自投入运行以来,已经发展成为一个涵盖各领域的服务系统。       

        卫星信号的捕获算法是卫星定位接收机的关键,传统的捕获算法通常采用基于fft的相干积分和非相干积分相结合的方法,例如在使用gps信号进行定位和导航前首先需要对卫星信号进行捕获,gps卫星信号的传统捕获算法一般为频域并行捕获算法,频域并行捕获算法的原理框图如图3所示,频域并行捕获算法是一种基于fft的捕获算法,搜索覆盖全部搜索频点和全部伪码序列,对于正常功率的gps信号,通常只需要处理lms的导航数据,就能够完成gps信号的捕获,但是对于gps弱信号而言,通常处理lms的导航数据所获得的判决量并不可靠,难以实现捕获,此时就需要通过增加捕获算法所用的数据长度,采用相关积分和非相关积分相结合的方法,来提高捕获灵敏度,但同时导致fft相关运算的计算量将成倍增长,从而造成捕获速度降低。

为了跟踪和解码GPS信号,首先要捕获到GPS信号。将捕获到的GPS信号的必要参数立刻传递给跟踪过程,再通过跟踪过程便可得到卫星的导航电文。GPS卫星处于高速运动中,因此,其频率会产生多普勒频移。载波频率与C/A码的多普勒频移将在下面详细讲述。

       GPS卫星发送的信号一般由3个分量组成:载波、伪码和导航电文,其中伪码和导航电文采用BPSK技术去调制载波。

       为了跟踪和解码GPS信号,首先要捕获到GPS信号。将捕获到的GPS信号的数据传递给跟踪过程,再通过跟踪过程便可得到卫星的导航电文。传统的GPS捕获方法有:串行搜索捕获、滑动相关法、循环相关法、PMF算法。

       GPS卫星信号是发生在两个L波段频率的载波信号L1和L2,两个载波频率分别是L1的主频率fL1和L2的次频率fL2。在L波段进行调制可以避免拥挤,因为L波段的频率占据使用比率和其他波段相比要低一些,有助于全球性观测;L波段上更容易进行扩频(将低比特率的电文转换成高比特率的组合码,有利于卫星信号的保密性),发送宽带信号;L波段大气偏差和电离偏差小,接收设备可以更简单、更经济地接收和测量。每一颗卫星均有唯一的扩频码或伪随机序列,由此调制出载波频率。

2.部分程序

clc;
clear;
close all;
warning off;
addpath(genpath(pwd));rng('default')
%%
%11111111111111111111111111111111111111111111111111111111111
isnoise         = 0;%1:add noise;0 good signal
%nosie awgn
SNR             = -19;%Q1
satellite       = [1,12,14,22];
satellitenumber = length(satellite);
fs              = 16.368e6; %sampling freq
IF              = 4.092e6;%centered
fIFD            = IF + 5e3 - 10e3*rand(1,satellitenumber);%no more than 5 KHz in absolute value
Fai             = 2*pi*rand(1,satellitenumber);%random values
Ai              = 0.7+0.3*rand(1,satellitenumber);%random between 1 and 0.7 for different satellites
taoi            = floor(4e5*rand(1,satellitenumber)) + 2e5; %random between 1 and 
Dur             = 20;%bit duration,20ms
Len             = 50;%data bit length,1s
%
CHIP_TIME       = 977.5e-9;    % chip time in seconds 
ts              = 1/fs;
n               = fs/1000; 
nn              = [0:n-1]; 
millisecond     = 1000;x_bound         = (ts/2)/CHIP_TIME;  % Maximum offset 
d_samp          = 6; % sample offset between correlators 
d               = (d_samp*ts)/CHIP_TIME;  
msSamp          = 16368;for i = 1:satellitenumberi%C%1ms with 16 samplescode0   = digitizg(fs/1000,fs,0,satellite(i));%20mscode1   = [code0,code0,code0,code0,code0,code0,code0,code0,code0,code0,code0,code0,code0,code0,code0,code0,code0,code0,code0,code0];%lenCA      = [];for j = 1:LenCA = [CA,code1];end%DDi0       = 2*double(rand(1,Len)>=0.5)-1;%output the datafor j = 1:LenDout2{i}(Dur*(j-1)+1:Dur*j) = Di0(j);endfor j = 1:length(Dout2{i})Di2(length(code0)*(j-1)+1:length(code0)*j) = Dout2{i}(j);end%Ssignal0 = Ai(i).*CA.*Di2;%16times%delay taoi/61delays  = floor(taoi(i)/61);signal3 = [zeros(1,delays),signal0(1:end-delays)];%carriert       = 0:1/fs:(length(signal3)-1)/fs;carrier{i} = cos(2*pi*fIFD(i)*t+Fai(i));Si0{i}     = signal3.*carrier{i};
end
%noise awgn
if isnoise==0Si_ = Si0;
elsefor i = 1:satellitenumberSi_{i} = awgn(Si0{i},SNR,'measured');end
end%combine
Si= Si_{1}; 
for i = 1:satellitenumber-1Si = Si + Si_{i+1}; 
endfigure;
subplot(221);
stem(Dout2{1});
title('data bits of satelite 1');
axis([0,1000,-2,2]);
subplot(222);
stem(Dout2{2});
title('data bits of satelite 12');
axis([0,1000,-2,2]);
subplot(223);
stem(Dout2{3});
title('data bits of satelite 14');
axis([0,1000,-2,2]);
subplot(224);
stem(Dout2{4});
title('data bits of satelite 22');
axis([0,1000,-2,2]);ttt = 0:1000/(length(Si)-1):1000;
figure;
plot(ttt,Si);
title('Combined Si');figure;
plot(ttt(10000:10200),Si(10000:10200));
title('Combined Si local');%%
%22222222222222222222222222222222222222222222222222
%fine frequency estimation
segment=5;
for a=1:satellitenumberfor b=1:segmentoutput               = acquisition(Si',satellite(a),b);correlation(:,a,b)   = output{1};correlationpeak(:,a) = output{2};frequency(:,a,b)     = output{3};finefrequency(a,b)   = output{4};                endfinefrequencyaverage(a)  = mean(finefrequency(a,:));
end
finefrequencyaverage
fIFD
err = finefrequencyaverage-fIFDX=[fIFD;finefrequencyaverage]';
figure;
bar(X);
axis([0,5,4.0e6,4.2e6]);
legend('Blue:real frequency','Red:fine frequency estimation');
xlabel('4 different satellite');
ylabel('frequency est');%code phase
segment=5;
for a=1:satellitenumberData = [Si]';for b=1:segmentoutput               = acquisition(Data,satellite(a),b);correlation(:,a,b)   = output{1};correlationpeak(:,a) = output{2};frequency(:,a,b)     = output{3};finefrequency(a,b)   = output{4};                endfinefrequencyaverage(a)  = mean(finefrequency(a,:));
endfigure;
codephases = [];
for a=1:satellitenumberPdata = correlation(:,a,1);subplot(4,1,a);plot(Pdata);[V,I] = max(Pdata);hold onplot(I,V,'r*');xlabel('times');ylabel('correlation');title(['satellite',num2str(satellite(a))]);codephases = [codephases,I];
end%code phase of 4 
codephases
taois=codephases*61 
taoi%%
%3 
for a=1:satellitenumberaData = [Si]';for c=1:millisecond%BASS method.%use the same C/A code from BASS to correlate all 1 ms segments one at a timecacode(:,a)           = digitizg(n,fs,0,satellite(a)); %fine frequencylc(:,a)               = exp(sqrt(-1)*2*pi*finefrequencyaverage(a)*ts*nn);lsi(:,a)              = cacode(:,a).*lc(:,a);lcf(:,a)              = fft(lsi(:,a));xf                    = fft(Data((c-1)*n+1:c*n));f(:,a)                = ifft(exp(-sqrt(-1)*2*pi*finefrequencyaverage(a)*ts*(c-1))*xf.* conj(lcf(:,a))); [amp(c,a),ccn(c,a)]   = max(abs(f(:,a)));        codephase(c,a)        = angle((f(ccn(c,a),a)));correlationphase(c,a) = angle((lsi(ccn(c,a),a)));endccnmax(a)   = max(ccn(:,a));tmps        = find(ccn(:,a)==ccnmax(a));location(a) = tmps(1);
endfigure
for a=1:satellitenumbersubplot(4,1,a);stem(codephase(:,a));title('Correlation result');
end
figure
for a=1:satellitenumbersubplot(4,1,a);stem(correlationphase(:,a));title('Correlation Phase');
end
figure
for a=1:satellitenumbersubplot(4,1,a);stem(amp(:,a));title('Correlation Magnitude');
end%Fine time estimate
for a=1:satellitenumberfor tt = 1:millisecondcacode(:,a)      = digitizg(n,fs,0,satellite(a)); ffreq            = finefrequencyaverage(a);code_phase       = ccn(c,a);local_carrier    = exp(1i*2*pi*ffreq*ts*nn); Data_carrier_off = [Data((tt-1)*n+1:tt*n)]'.*local_carrier; input_ms_tt      = Data_carrier_off;    corrs            = ifft(fft(input_ms_tt).* [conj(fft(cacode(:,a)))]'); early            = corrs(code_phase - d_samp);late             = corrs(code_phase + d_samp); r(tt,a)            = abs(late)/abs(early); x(tt,a)            = ((1-r(tt,a))*(1-d))/(1+r(tt,a));  if mod(tt,10) == 0 xx(tt/10,a) = mean(x(tt-9:tt,a));  % Average the past 10 fine time estimates end  end
endfigure; 
for i=1:satellitenumber
subplot(4,1,i);
stem(xx(:,i)*CHIP_TIME); 
title('Averaged Fine Time Estimates for 10ms segments of data'); 
xlabel('10ms'); 
ylabel('Fine time Est (s)'); 
endfigure;
for i=1:satellitenumber
subplot(4,1,i);
stem(x(:,i)*CHIP_TIME); 
title('Fine Time Estimates for 1 ms segments of data'); 
xlabel('1ms '); 
%xlim([0,13]); 
ylabel('Fine time Est (s)'); 
end
%%
%456together
%phase transitions
for sj=1:satellitenumbertmps = find(amp(:,sj)>0);start(sj) = tmps(1);fprintf(['The initial data bits boundary from satellite ',num2str(satellite(sj)),' is : ',num2str(start(sj)),'ms\n\n']);Recive_bits(:,sj) = Dout2{sj}(1)*ones(Len*Dur,1);
end
for sj=1:satellitenumber%enhance the special pointcorrd = [amp(:,sj)].*[amp(:,sj)].*[amp(:,sj)].*[amp(:,sj)];corrd = corrd-min(corrd);%find the transitions positionCount1=0;Count2=0;for j = 3:length(corrd)-2if corrd(j)>2*corrd(j-1) & corrd(j)>2*corrd(j+1) & corrd(j)>2*corrd(j-2) & corrd(j)>2*corrd(j+2) Count1=Count1+1; endif corrd(j)<0.4*corrd(j-1) & corrd(j)<0.4*corrd(j+1) & corrd(j)<0.4*corrd(j-2) & corrd(j)<0.4*corrd(j+2) Count2=Count2+1; end        endif Count1 < Count2threshold = 0.4*mean(corrd);Pos      = find(corrd<=threshold);elsethreshold = 1.5*mean(corrd);Pos      = find(corrd>=threshold);endif isempty(Pos)==1if sj == 1 ;disp('satellite 1  failed.....'); endif sj == 12;disp('satellite 12 failed.....'); endif sj == 14;disp('satellite 14 failed.....'); endif sj == 22;disp('satellite 22 failed.....'); endelseif Pos(1)==1for j = 3:length(Pos);Recive_bits(Pos(j-1)+1:Pos(j),sj) = -1*Recive_bits(Pos(j-1),sj);%transitionsendelsefor j = 2:length(Pos);Recive_bits(Pos(j-1)+1:Pos(j),sj) = -1*Recive_bits(Pos(j-1),sj);%transitionsendendRecive_bits(Pos(end)+1:end,sj) = -1*Recive_bits(Pos(end),sj);end
endfigure;
subplot(221);
stem(Recive_bits(:,1));title('The data bits of satellite 1');
axis([0,1000,-2,2]);
subplot(222);
stem(Recive_bits(:,2));title('The data bits of satellite 12');
axis([0,1000,-2,2]);
subplot(223);
stem(Recive_bits(:,3));title('The data bits of satellite 14');
axis([0,1000,-2,2]);
subplot(224);
stem(Recive_bits(:,4));title('The data bits of satellite 22');
axis([0,1000,-2,2]);

3.算法部分仿真结果图

 

 

 

 

 

 

 01-155m

4.完整程序获取

使用版本matlab2022a

解压密码:C+123456

获得方式1:

m基于matlab的GPS卫星信号捕获和数据解析仿真

获取方式2:

如果下载链接失效,加博主微信,或私信。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.luyixian.cn/news_show_23339.aspx

如若内容造成侵权/违法违规/事实不符,请联系dt猫网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Markdown语法(Typora)

Markdown语法(Typora) 样式标题 一级标题:#+空格+标题,回车 二级标题:##+空格+标题,回车 以此类推,最多可支持六级标题字体 加粗:** + 字体 + ** ( *与字体之间没有空格)例:hello world 斜体:* +字体 + * ( * 与字体之间没有空格)例:hello world 加粗和斜体:* …

微信小程序入门与实战之电影页面与实战自定义组件

Movie自定义组件 Movie自定义组件包含三部分&#xff1a;图片、标题和图片&#xff0c;评分可以再单独写一个组件。 实现代码&#xff1a; <view class"container"><image class"poster" src"/images/daomengkongjian.jpg"></…

sql语句清空表数据三种方式:

转载地址 1.delete------ 是逐行删除速度极慢,不适合大量数据删除。Delete from tablename where 1=12.truncate---- 删除所有数据,保留表结构,不能撤消还原。TRUNCATE TABLE tablename3.drop-------- 删除表,数据和表结构一起删除,快速。SET FOREIGN_KEY_CHECKS=0;-- ---…

USB-C接口充电UFP PD sink诱电(取电)芯片功能介绍

随着Type-C接口在手机、电脑等便携设备上普及&#xff0c;日常使用中或许会遇到如下问题。 为什么这个Type-C充电器充电这么慢&#xff1f; 电脑的Type-C充电器能给手机充电吗&#xff1f; PD充电&#xff1f;Type-C充电&#xff1f;有什么区别&#xff1f; 要解答以上几个…

小程序中如何实现搜索框样式

大家好&#xff0c;我是雄雄。 今天 给大家看看在如何在小程序中实现搜索的样式。 首先先上图看看是啥样的&#xff1a; 小程序里面用的组件是vant-weapp,所以需要在使用之前&#xff0c;需要引入vant-weapp的依赖&#xff0c;引入依赖的方法&#xff1a;小程序中安装vant依赖…

【Lyra UI】玩法逻辑小结

【Lyra UI】玩法逻辑小结 UI 这块分两个部分&#xff1a;功能版逻辑 材质效果 本篇讨论逻辑&#xff0c;即怎么组织UI结构&#xff0c;代码怎么串联事件和逻辑 笔者之前并没有用UE开发过游戏&#xff0c;也算是从零开始&#xff0c;所以并不保证完整性和准确性 大纲 进度…

剑指offer 65. 翻转单词顺序

✍个人博客&#xff1a;https://blog.csdn.net/Newin2020?spm1011.2415.3001.5343 &#x1f4da;专栏地址&#xff1a;剑指offer系列题解 &#x1f4dd;原题地址&#xff1a;题目地址 &#x1f4e3;专栏定位&#xff1a;为找工作的小伙伴整理常考算法题解&#xff0c;祝大家都…

vSphere 8 (ESXi 8.0.0)

VMware 最新发布了vSphere 8 VMware vSphere 8.0 Release Notes Notes: 请注意Release Notes中提到的被抛弃支持的硬件。 如果只是旧的CPU不被支持了&#xff0c;可以在安装ESXi启动时ShiftO 后面加上空格allowLegacyCPUtrue 第一时间在我的SuperMicro E302-9D上安装了vSphe…

酒店企业私域流量运营方案来了

在新冠肺炎疫情的冲击下&#xff0c;酒店行业客流量明显下滑&#xff0c;部分酒店的出租率甚至已经下降到10%以下&#xff0c;企业亟须找到和用户直接互动并转化有效渠道&#xff0c;私域显然是一个开发成本较低且可帮助企业精准触达的方式。 为了帮助酒店企业提升私域运营能力…

动词时态=3.现在时态和过去时态构成详解

现在时态构成详解 一般现在时态 最容易构成的时态,直接加动词原形(字典当中显示的词条)就可以 第三人称"单数"的话需要加s这是最容易出错的时态;容易将 现在的时间,和一般的状态;弄混 其实这个我觉得还好,通过之前的理解例如第一句:并非是我正在吃胡萝卜,而…

Android Studio构建可运行的‘java-library’程序库

1、新建模块 2、导入或新建代码 ... 3、build.gradle构建 plugins {id java-library }java {sourceCompatibility JavaVersion.VERSION_1_7targetCompatibility JavaVersion.VERSION_1_7 }jar {manifest { //运行时main函数的主类attributes Main-Class: com.XXX.XXX.XXXC…

微信小程序商城开发的流程

今天珍奶bb给大家简单唠唠微信小程序商城开发的流程&#xff1f; 在唠微信小程序商城制作流程前&#xff0c;先给大家科普一下当前的实体经济环境是如何的&#xff1f;制作一个微信小程序商城是否存在它的必要性。不用看具体数据&#xff0c;就直接看我们身边&#xff0c;我们…

springboot+springcloudgateway+nacos+sleuth+zipkin+mysql

zipkin服务端安装 1.下载zipkin的Jar包 https://search.maven.org/remote_content?gio.zipkin.java&azipkin-server&vLATEST&cexec windows 命令行cd到zipkin目录下 C:\zipkin 启动命令&#xff1a;java -jar zipkin-server-2.12.9-exec.jar 打开浏览器&…

如何在贵金属白银现货走势分析中积累经验?

贵金属白银现货走势分析中&#xff0c;只有一种东西是只可意会不可言传的&#xff0c;那就是经验。很多人会有这样的经历&#xff0c;为什么大家学习的是同样的方法&#xff0c; 他能够赚钱&#xff0c;而我不能够赚钱呢&#xff1f;这其实就是经验所致。在贵金属白银现货走势分…

猿创征文|我这样看国产数据库TBase

文章目录一、云原生数据库二、功能介绍三、适用场景一、云原生数据库 随着云业务形态的诞生&#xff0c;这两年在传统的数据库架构基础上&#xff0c;产生一种比较流行的新架构–云原生架构&#xff0c;日志即数据库。 它会把数据库的业务逻辑沉到底层的存储节点里面去&…

操作系统导论习题解答(41. Fast File System (FFS))

Locality and The Fast File System "old UNIX file system" looked like this:super block(S): contains information about the entire file system inode region: contains all the inodes for the file system data region: contains user data 1. The Problem…

UE4 /UE5 PC/安卓优化

一、概述 UE4/UE5场景中的资源越多&#xff0c;消耗的内存就越大&#xff0c;就会越卡顿。这里教大家如何进行场景优化&#xff0c;来减少内存&#xff0c;使得场景更加流畅。 二、模型优化 2.1、使用3Dmax或者Maya制作的模型&#xff0c;面数最好不要太多&#xff0c;虽然UE4…

国内首家车身区域控制器量产 电子电气架构进入中央集中式3.0阶段

从功能独立的分布式架构&#xff0c;到功能集成的域控制架构&#xff0c;如今整车电子电气架构正在加速跨入集中式电子电气架构3.0阶段。 在中央集中式架构中&#xff0c;算力逐渐向中央集中&#xff0c;多个域控制器继续融合最终形成1个中央计算平台N个区域控制器的终极布局&…

操作系统导论习题解答(29. Locked Data Structures)

Lock-based Concurrent Data Structures 带着问题:给定一个数据结构,如何给其添加锁使其拥有正确性和高效性? 1. Concurrent Counters 1.1 Simple But Not Scalable上述代码满足了正确性,但是对于性能,我们一无所知。为了了解性能优劣,做了一个基准测试,如下所示(preci…

零时科技 || Rabby Swap合约遭受攻击事件详解

0x1 背景 2022年10月12日&#xff0c;Rabby Swap合约中存在疑似任意用户资产转移漏洞。Rabby Swap官方表示&#xff0c;如果有使用&#xff0c;请撤销所有链上所有现有的 Rabby Swap 批准。对于没有使用过 Swap 的人来说&#xff0c;钱包安全且不受影响。零时科技安全团队及时…