Unable to solve correct GPS receiver position with MATLAB internal functions

9 views (last 30 days)
Dear Community
I want to post process received GPS data with the relatively new MATLAB functions. MATLAB loads RINEX files, processes them and plots the positions.
RINEX Data I use a Septentrio X5 receiver with a navXperience 3G+C maritime antenna to log raw data into a SBF-file. The file contains observations from one hour. Then I use RTKCONV from RTKLIB to convert the SBF-File into RINEX Navigation and Observation files, see attached. The Antenna position is:
ECEF: 4267425.180, 655030.289, 4679698.745
WGS84: 47.4976660732, 8.7265311946, 510.424 N
MATLAB Inside MATLAB I run the following code (also attached):
%% read files
% NAV (Ephemeris)
navfile = "20220912-225553_log.nav";
navdata = rinexread(navfile);
% OBS (Receiver Measurements)
obsfile = "20220912-225553_log.obs";
obsdata = rinexread(obsfile); % time is GPS Time (UTC + 19 s)
%% Solve GPS
% timestamps to solve
t = unique(obsdata.GPS.Time);
% positions vector
pos = zeros(length(t),3);
for i=1:length(t)
% select observables
obs = obsdata.GPS(find(and(obsdata.GPS.Time==t(i), ~isnan(obsdata.GPS.C1W))),:);
pr = timetable2table(obs(:,["SatelliteID","C1W"]),"ConvertRowTimes",false); % table with pseudoranges
% calculate Satellite positions
nav = navdata.GPS(ismember(navdata.GPS.SatelliteID,obs.SatelliteID),:);
[navPos,~,navIDs] = gnssconstellation(t(i),RINEXData=nav);
satPos = [navIDs,navPos];
satPos = array2table(satPos,"VariableNames",["SatelliteID", "x", "y", "z"]);
% join tables with pseudoranges and satellite positions
tab = join(pr,satPos);
% solve
pos(i,:) = receiverposition(table2array(tab(:,"C1W")),table2array(tab(:,["x","y","z"])));
end
geoplot(pos(:,1),pos(:,2),'.')
Solution The solution from the MATLAB script is far away from the correct antenna position, see the attached plot. If I use RTKPOST from RTKLIB to load the same exact RINEX files, the solution is plausible, see the attached KML-File. Therefore I assume that the problem is within my MATLAB code.
Does anybody have an idea what I'm doing wrong?
Thanks for your help!
Best wishes,
Simon

Accepted Answer

Simon Moser
Simon Moser on 3 Jan 2023
We found out what we did wrong, respectively which calculation steps were forgotten:
  • The signal propagation time was not considered and therefore the satellite position was calculated for the wrong point in time.
  • The clock offset from the ephemeris data was not considered.
  • The relativistic time correction was not considered.
If the mentioned points are considered, useful solutions result.
  2 Comments
Robert
Robert on 9 May 2023
Hey!
I'm currently having similar errors and I'd love it if you could give me some indication on how you solved it.
Thanks!
Simon Moser
Simon Moser on 10 May 2023
Hi Robert
The problem were the positions of de SVs which were passed to the function receiverposition. Before the data of the RINEX can be passed to the function gnssconstellation, it must be edited according the three calculation steps mentioned above.
I've attached my function which calculates the satellite positions. Please note that I'm not exactly sure, if everything is correct ans please note also that it is crazy slow. In the meantime we switched to the usage of RTKLIB.
Best,
Simon

Sign in to comment.

More Answers (0)

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!