mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 04:30:33 +00:00
Clean up Matlab/Octave code
This commit is contained in:
parent
5dea6da9e0
commit
c58107d56c
@ -1,32 +1,28 @@
|
||||
% /*!
|
||||
% * \file plot_dump.m
|
||||
% * \brief Read GNSS-SDR Tracking dump binary file and plot some internal
|
||||
% variables
|
||||
% * \author Antonio Ramos, 2018. antonio.ramos(at)cttc.es
|
||||
% * -------------------------------------------------------------------------
|
||||
% *
|
||||
% * Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
|
||||
% *
|
||||
% * GNSS-SDR is a software defined Global Navigation
|
||||
% * Satellite Systems receiver
|
||||
% *
|
||||
% * This file is part of GNSS-SDR.
|
||||
% *
|
||||
% * GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
% * it under the terms of the GNU General Public License as published by
|
||||
% * the Free Software Foundation, either version 3 of the License, or
|
||||
% * at your option) any later version.
|
||||
% *
|
||||
% * GNSS-SDR is distributed in the hope that it will be useful,
|
||||
% * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
% * GNU General Public License for more details.
|
||||
% *
|
||||
% * You should have received a copy of the GNU General Public License
|
||||
% * along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
% *
|
||||
% * -------------------------------------------------------------------------
|
||||
% */
|
||||
% -------------------------------------------------------------------------
|
||||
%
|
||||
% Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
|
||||
%
|
||||
% GNSS-SDR is a software defined Global Navigation
|
||||
% Satellite Systems receiver
|
||||
%
|
||||
% This file is part of GNSS-SDR.
|
||||
%
|
||||
% GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
% it under the terms of the GNU General Public License as published by
|
||||
% the Free Software Foundation, either version 3 of the License, or
|
||||
% at your option) any later version.
|
||||
%
|
||||
% GNSS-SDR is distributed in the hope that it will be useful,
|
||||
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
% GNU General Public License for more details.
|
||||
%
|
||||
% You should have received a copy of the GNU General Public License
|
||||
% along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
%
|
||||
% -------------------------------------------------------------------------
|
||||
%
|
||||
% Antonio Ramos, 2018. antonio.ramos(at)cttc.es
|
||||
|
||||
clear all;
|
||||
clc;
|
||||
@ -109,7 +105,6 @@ v_3d=[E;N;U].'; %2D East Nort position vectors
|
||||
|
||||
sigma_E_accuracy = sqrt((1/(numPoints-1)) * sum((v_2d(:,1) - mean_utm_X).^2));
|
||||
sigma_N_accuracy = sqrt((1/(numPoints-1)) * sum((v_2d(:,2) - mean_utm_Y).^2));
|
||||
|
||||
sigma_ratio_2d_accuracy = sigma_N_accuracy / sigma_E_accuracy
|
||||
|
||||
% if sigma_ratio=1 -> Prob in circle with r=DRMS -> 65%
|
||||
@ -125,7 +120,6 @@ sigma_U_accuracy=sqrt((1/(numPoints-1))*sum((v_3d(:,3)-mean_utm_Z).^2));
|
||||
|
||||
% if sigma_ratio=1 -> Prob in circle with r=DRMS -> 50%
|
||||
SEP_accuracy = 0.51 * sqrt(sigma_E_accuracy^2 + sigma_N_accuracy^2 + sigma_U_accuracy^2)
|
||||
|
||||
% if sigma_ratio=1 -> Prob in circle with r=DRMS -> 61%
|
||||
MRSE_accuracy = sqrt(sigma_E_accuracy^2 + sigma_N_accuracy^2 + sigma_U_accuracy^2)
|
||||
% if sigma_ratio=1 -> Prob in circle with r=2DRMS -> 95%
|
||||
@ -135,14 +129,9 @@ TWO_MRSE_accuracy=2*MRSE_accuracy
|
||||
|
||||
%% PRECISION
|
||||
|
||||
% 2D analysis
|
||||
% Simulated X,Y measurements
|
||||
%v1=randn(1000,2);
|
||||
|
||||
% 2D Mean and Variance
|
||||
mean_2d = [mean(v_2d(:,1)) ; mean(v_2d(:,2))];
|
||||
sigma_2d = [sqrt(var(v_2d(:,1))) ; sqrt(var(v_2d(:,2)))];
|
||||
|
||||
sigma_ratio_2d = sigma_2d(2) / sigma_2d(1)
|
||||
|
||||
% if sigma_ratio=1 -> Prob in circle with r=DRMS -> 65%
|
||||
@ -152,47 +141,45 @@ TWO_DRMS=2*DRMS
|
||||
% if sigma_ratio>0.3 -> Prob in circle with r=CEP -> 50%
|
||||
CEP = 0.62 * sigma_2d(1) + 0.56 * sigma_2d(2)
|
||||
|
||||
|
||||
% Mean and Variance
|
||||
% 3D Mean and Variance
|
||||
mean_3d = [mean(v_3d(:,1)) ; mean(v_3d(:,2)) ; mean(v_3d(:,3))];
|
||||
sigma_3d = [sqrt(var(v_3d(:,1))) ; sqrt(var(v_3d(:,2))) ; sqrt(var(v_3d(:,3)))];
|
||||
|
||||
% absolute mean error
|
||||
% 2D
|
||||
|
||||
error_2D_vec = [mean_utm_X-mean_2d(1) mean_utm_Y-mean_2d(2)];
|
||||
error_2D_m = norm(error_2D_vec)
|
||||
|
||||
error_3D_vec = [mean_utm_X-mean_3d(1) mean_utm_Y-mean_3d(2) mean_utm_Z-mean_3d(3)];
|
||||
error_3D_m = norm(error_3D_vec)
|
||||
|
||||
% RMSE 2D
|
||||
|
||||
RMSE_X = sqrt(mean((v_3d(:,1)-mean_utm_X).^2))
|
||||
RMSE_Y = sqrt(mean((v_3d(:,2)-mean_utm_Y).^2))
|
||||
RMSE_Z = sqrt(mean((v_3d(:,3)-mean_utm_Z).^2))
|
||||
|
||||
|
||||
RMSE_2D = sqrt(mean((v_2d(:,1)-mean_utm_X).^2 + (v_2d(:,2)-mean_utm_Y).^2))
|
||||
|
||||
RMSE_3D = sqrt(mean((v_3d(:,1)-mean_utm_X).^2 + (v_3d(:,2)-mean_utm_Y).^2 + (v_3d(:,3)-mean_utm_Z).^2))
|
||||
|
||||
% SCATTER PLOT
|
||||
% if sigma_ratio=1 -> Prob in circle with r=DRMS -> 50%
|
||||
SEP = 0.51 * sqrt(sigma_3d(1)^2 + sigma_3d(2)^2 + sigma_3d(3)^2)
|
||||
% if sigma_ratio=1 -> Prob in circle with r=DRMS -> 61%
|
||||
MRSE = sqrt(sigma_3d(1)^2 + sigma_3d(2)^2 + sigma_3d(3)^2)
|
||||
% if sigma_ratio=1 -> Prob in circle with r=2DRMS -> 95%
|
||||
TWO_MRSE = 2 * MRSE
|
||||
|
||||
|
||||
%% SCATTER PLOT 2D
|
||||
subplot(3,3,8)
|
||||
scatter(v_2d(:,1)-mean_2d(1), v_2d(:,2)-mean_2d(2));
|
||||
hold on;
|
||||
|
||||
plot(0, 0, 'k*');
|
||||
|
||||
|
||||
[x,y,z] = cylinder([TWO_DRMS TWO_DRMS], 200);
|
||||
plot(x(1,:), y(1,:), 'Color', [0 0.6 0]);
|
||||
str = strcat('2DRMS=', num2str(TWO_DRMS), ' m');
|
||||
text(cosd(65)*TWO_DRMS, sind(65)*TWO_DRMS, str, 'Color', [0 0.6 0]);
|
||||
|
||||
|
||||
[x,y,z] = cylinder([CEP CEP], 200);
|
||||
|
||||
plot(x(1,:), y(1,:), 'r--');
|
||||
str = strcat('CEP=', num2str(CEP), ' m');
|
||||
text(cosd(80)*CEP, sind(80)*CEP, str, 'Color','r');
|
||||
@ -202,20 +189,9 @@ axis equal;
|
||||
xlabel('North [m]','fontname','Times','fontsize', fontsize)
|
||||
ylabel('East [m]','fontname','Times','fontsize', fontsize)
|
||||
|
||||
% 3D analysis
|
||||
% Simulated X,Y,Z measurements
|
||||
|
||||
% if sigma_ratio=1 -> Prob in circle with r=DRMS -> 50%
|
||||
SEP=0.51*sqrt(sigma_3d(1)^2+sigma_3d(2)^2+sigma_3d(3)^2)
|
||||
|
||||
% if sigma_ratio=1 -> Prob in circle with r=DRMS -> 61%
|
||||
MRSE=sqrt(sigma_3d(1)^2+sigma_3d(2)^2+sigma_3d(3)^2)
|
||||
% if sigma_ratio=1 -> Prob in circle with r=2DRMS -> 95%
|
||||
TWO_MRSE=2*MRSE
|
||||
|
||||
|
||||
|
||||
% SCATTER PLOT
|
||||
%% SCATTER PLOT 3D
|
||||
subplot(3,3,9)
|
||||
scatter3(v_3d(:,1)-mean_3d(1), v_3d(:,2)-mean_3d(2), v_3d(:,3)-mean_3d(3));
|
||||
|
||||
@ -223,10 +199,8 @@ hold on;
|
||||
|
||||
[x,y,z] = sphere();
|
||||
hSurface = surf(MRSE*x, MRSE*y, MRSE*z); % sphere centered at origin
|
||||
|
||||
set(hSurface, 'facecolor', 'none', 'edgecolor', [0 0.6 0], 'edgealpha', 1, 'facealpha', 1);
|
||||
|
||||
%axis equal;
|
||||
xlabel('North [m]', 'fontname', 'Times', 'fontsize', fontsize-2)
|
||||
ylabel('East [m]', 'fontname', 'Times', 'fontsize', fontsize-2)
|
||||
zlabel('Up [m]', 'fontname', 'Times', 'fontsize', fontsize-2)
|
||||
|
Loading…
Reference in New Issue
Block a user