当前位置:网站首页>Code example of MATLAB reading GNSS observation value o file
Code example of MATLAB reading GNSS observation value o file
2022-07-06 12:53:00 【Proletarians】
One 、 preparation
Observation data reading is the premise of data processing , Usually , The data formats of observations are rtcm、ubx、rinex, Manufacturers also have custom formats . Data reading is the simplest job , Mastering the data organization format means mastering the data reading strategy , in short , We do a series of operations on strings . I think that's right. o The following preparations should be made for file reading , Namely :
(1) install Matlab Of PC;
(2) Study rinex.pdf Information ;
(3)o Document preparation ;
(4) Pseudocoding , Clear the data flow ;
(5) Code testing
We are using location methods SPP/PPP/RTK when , It is to read the observation value of the satellite according to the epoch (PR/CP),Doppler,SNR Etc , The subsequent processing is to cycle through all the satellites , Do different things .
Two 、 Problems to be solved
The problem is : To achieve the use of Matlab Draw the pseudo range observation value sequence diagram of satellites with different satellite systems in the observation arc .
In the above problem analysis , Easy to know satellite PRN The number is the only one , Can be used as key; The satellite corresponds to the observed value (PC/CP/Doppler), Can be used as value. In other words ,key and value have access to map As a data structure , among ,value You can use a structure to save . The most important link has been determined , That is to use map and struct.
Next , Let's take the pseudo range value in the observation arc of a satellite , There are several possible situations :
(1) In the observation arc , The satellite has been captured , namely 100% There is a pseudo range value ;
(2) In the observation arc , The satellite was not captured at the beginning of the epoch , Then they were captured ;
(3) stay (2) There are still uncapped , Capture , Not captured , Capture, etc ;
The observed value is 0, meanwhile , We should also pay attention to , If there is a pseudo range, there is not necessarily a carrier , There must be no pseudo range without carrier . Our pseudo code mainly judges the above three situations .
3、 ... and 、 Code implementation
Specific analysis of specific problems , Solve the problems mentioned above , The specific code is as follows :
% function: read the body of rinex obs file
clear all
close all
clc
fid=fopen(' example.obs');
if fid==-1
disp('fail to open obs file!');
end
% Create structure obs, Use Map mapping ,prn As the key (char),sv Value (table)
obs=containers.Map;
record_counter=0;
% Read body Record
while feof(fid)==0
line=fgets(fid);
if strcmp(line(1),'>')
sv_sum=str2double(line(34:35));
time=line(3:29);
if sv_sum>0
for i=1:sv_sum
line=fgets(fid);
% key -> prn
key=line(1:3);
% value -> sv(pr cp dop)
sv.pr=str2double(line(6:17));
cp=line(21:33);
if isnan(cp)
sv.cp=0;
else
sv.cp=str2double(line(21:33));
end
sv.dop=str2double(line(41:49));
% Value logic judgment
if isKey(obs,key)
jump_sec=record_counter-length(obs(key));
if jump_sec~=0 % Solve the problem of relocking after losing the star
temp.pr=0;
temp.cp=0;
temp.dop=0;
tmp_strcut=repmat(temp,1,jump_sec);
value=[obs(key) tmp_strcut sv];
else % The satellite has been locked , Add directly
if strcmp(key,'C18')==1
if length(obs(key))>5713
disp(time);
end
end
value=[repmat(obs(key),1) repmat(sv,1)]; % mark
end
else % The satellite is locked for the first time
if record_counter~=0 % The first second is unlocked
temp.pr=0;
temp.cp=0;
temp.dop=0;
tmp_strcut=repmat(temp,1,record_counter);
value=[tmp_strcut sv];
else % First second lock
value=sv;
end
end
obs(key)=value;
end
end
record_counter=record_counter+1;
end
end
disp('create struct obs(body) successfully!');
% mapping
sv_sum=obs.Count; % The number of visual satellites
keySet=keys(obs); % Visual satellite name
disp(keySet);
v=299792458.0;
bf1=1.561098E9; % bds L1 frequency
gf1=1.57542E9; % gps L1 frequency
gps_sum=0;bds_sum=0;
for i=1:sv_sum
prn=char(keySet(i));
if strcmp(prn(1),'G')==1 % GPS
gps_sum=gps_sum+1;
else if strcmp(prn(1),'C')==1 % BDS
bds_sum=bds_sum+1;
end
end
end
subfig1=ceil(sqrt(bds_sum));
subfig2=ceil(sqrt(gps_sum));
x=1:record_counter;
for i=1:sv_sum
prn=char(keySet(i));
info=obs(prn);
pr=zeros(1,record_counter);cp=pr;
for j=1:length(info)
pr(j)=info(j).pr;
cp(j)=info(j).cp;
end
if i==1 || i==bds_sum+1
figure;
end
subplot(n,n,pos);
plot(x,pr,'r',x,cp*f,'g');
title(char(prn));
end
Four 、 Sample results
I only focus on the problems encountered in my work rinex Version data processing ,gps/bds Dual system , Single frequency data , The results are as follows :

The sample code is simple , There are also corresponding notes .
边栏推荐
- Particle system for introduction to unity3d Foundation (attribute introduction + case production of flame particle system)
- WSL common commands
- Easy to use shortcut keys in idea
- [algorithm] sword finger offer2 golang interview question 7: 3 numbers with 0 in the array
- (core focus of software engineering review) Chapter V detailed design exercises
- How to reduce the shutdown time of InnoDB database?
- Idea problem record
- Mysql database reports an error: row size too large (> 8126) Changing some columns to TEXT or BLOB or using ROW_ FORMAT=DY
- [899] ordered queue
- [算法] 剑指offer2 golang 面试题2:二进制加法
猜你喜欢
随机推荐
rtklib单点定位spp使用抗差估计遇到的问题及解决
What are the advantages of using SQL in Excel VBA
InnoDB dirty page refresh mechanism checkpoint in MySQL
【rtklib】在rtk下使用抗差自适应卡尔曼滤波初步实践
Unity3D制作注册登录界面,并实现场景跳转
音乐播放(Toggle && PlayerPrefs)
[算法] 劍指offer2 golang 面試題2:二進制加法
[algorithm] sword finger offer2 golang interview question 9: subarray with product less than k
MySQL shutdown is slow
Itext 7 生成PDF总结
【GNSS】抗差估计(稳健估计)原理及程序实现
Conditional probability
wsl常用命令
(the first set of course design) 1-4 message passing interface (100 points) (simulation: thread)
微信小程序开发心得
[算法] 剑指offer2 golang 面试题12:左右两边子数组的和相等
Fairygui gain buff value change display
FairyGUI循环列表
【RTKLIB 2.4.3 b34 】版本更新简介一
KF UD分解之UD分解基础篇【1】



![[算法] 剑指offer2 golang 面试题6:排序数组中的两个数字之和](/img/d5/4bda133498f71ae9fd7a64c6cba8f0.png)
![[算法] 剑指offer2 golang 面试题2:二进制加法](/img/c2/6f6c3bd4d70252ba73addad6a3a9c1.png)




![[算法] 剑指offer2 golang 面试题3:前n个数字二进制形式中1的个数](/img/64/0f352232359c7d44f12b20a64c7bb4.png)