Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculate the covariance matrix #724

Open
samperizal opened this issue Sep 16, 2023 · 1 comment
Open

Calculate the covariance matrix #724

samperizal opened this issue Sep 16, 2023 · 1 comment

Comments

@samperizal
Copy link

Greetings.

Someone tell me how to reconstruct the complete covariance matrix from the data obtained with RTKNAVI or RTKPOST.

Thanks in advance.

Sorry for my English.

@gpoleszuk
Copy link

gpoleszuk commented Nov 9, 2023

For example

% (x/y/z-ecef=WGS84,Q=1:fix,2:float,3:sbas,4:dgps,5:single,6:ppp,ns=# of satellites)
%  GPST                      x-ecef(m)      y-ecef(m)      z-ecef(m)   Q  ns   sdx(m)   sdy(m)   sdz(m)  sdxy(m)  sdyz(m)  sdzx(m) age(s)  ratio
2023/01/07 07:00:00.000   ****099.5227  -****927.2761  -****538.8151   2  10   0.0082   0.0107   0.0047   0.0040   0.0033  -0.0043   0.00    0.0

Then, if the sdx, sdy and sdz are provided, you can reconstruct the main diagonal of the covariance matrix squaring each value.

Now, to reconstruct the covariances, since they are provided as sdxy, sdyz, sdzx you can set the off-diagonal ellements. Since the covariance matrix is a symmetrical matrix, you can set both off-diagonal elements in the upper- and low-triangulars as below:

Kxx = [
sdx^2 sdxy  sdzx
sdxy  sdy^2 sdyz
sdzx  sdyz sdz^2
]

Please, check if the covariance matrix (CM) reconstructed makes sense, for example:

  1. checking the structure of the CM. It should be symmetrical and the main diagonal elements always positive numbers.
  2. calculating the correlations from it, for example,
rho_xy = Kxx(1,2) / sqrt( Kxx(1,1) * Kxx(2,2) )
rho_yz = Kxx(2,3) / sqrt( Kxx(2,2) * Kxx(3,3) )
rho_xz = Kxx(1,3) / sqrt( Kxx(1,1) * Kxx(3,3) )

If the values of rho_xy, rho_yz, and rho_xz ​are between -1 and 1 the CM seems O.K.. Otherwise there are mistakes and you have to check what is wrong.

PS: Could you please inform which RTKLib version are you using in your experiments? I had the same need and I could notice that the information related to the "covariances" from rnx2rtkp are suspect, maybe misreported by the RTKLIB-2.4.3-b34. I hope you fixed it, ie. taking the square of all covariances and preserving the signal of those are negative. Check the source code and compare it with the theory related to covariance matrices : )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants