⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xraimfd.m

📁 GPS TOOLBOX包含以下内容: 1、GPS相关常量和转换因子; 2、角度变换; 3、坐标系转换: &#61656 点变换; &#61656 矩阵变换; &#61656 向量变换
💻 M
字号:
%                             xraimfd.m
%  Scope:   This MATLAB program implements the fault detection algorithm [1]
%           for the Receiver Autonomous Integrity Monitoring (RAIM) by using 
%           parity vector method, for a specified set of input data.
%  Usage:   xraimfd
%  Inputs:  - name of the data file containing line-of-sight unit vectors,
%             each vector is stored in another row (it should be 3 columns);
%             a set of default values is specified. The LOS inpu data for 
%             multiple steps are appended one after another.
%           - number of steps to be executed; the default is 1
%           - number of measurements for each step; the default is 7
%           - name of the output file (optional); the default is the screen
%           - values for probability of false alarm, probability of missed
%             detection and standard deviation of measurement noise are 
%             selected by default
%  Outputs: - values of the selected input data set
%           - status of the output flags (false alarm, true alarm, missed
%             detection, normal operation and unavailable) for each step
%  References: 
%          [1] Van Graas, F., Farrell, J. L., Baseline fault detection and
%              exclusion algorithm. Institute of Navigation, Proceedings of 
%              the 49th Annual Meeting, Cambridge, MA, June 21-23, 1993,
%              pp. 413-420.
%  External Matlab macros used:  raimfd
%  Last update:  08/05/00
%  Copyright (C) 1996-00 by LL Consulting. All Rights Reserved.

clear 
yes = 'y';

randn('seed',78315);  %  use a normal distribution

pfa = 6.6667e-5;      %  probability of false alarm
pmd = 1.e-3;          %  probability of missed detection
sigma = 33.33;        %  standard deviation of measurement noise (in meters),
                      %  for SPS with SA on  

%  Enter line-of-sight unit vectors, number of steps, and number of 
%  measurements for each step

disp('  ');
disp('Enter line-of-sight unit vectors ');
disp('  ');
answer1 = input('Do you want to use the default data? (y/n)[y] --> ','s');
if isempty(answer1)
   answer1 = yes;
end   
disp('  ');
if (strcmp(answer1,yes) == 1)
   g  = [ 7.787995e-002  -6.017930e-001   7.947552e-001
          1.730016e-001  -9.665970e-001  -1.891052e-001
         -8.457427e-001  -4.893909e-001  -2.126402e-001
         -5.385451e-001  -2.338803e-001   8.094870e-001
          4.345836e-001  -7.366578e-001  -5.181432e-001
          7.052152e-001  -5.433383e-001   4.554723e-001
         -8.973768e-001   3.366878e-001   2.852302e-001 
          1.730016e-001  -9.665970e-001  -1.891052e-001
         -8.457427e-001  -4.893909e-001  -2.126402e-001
         -5.385451e-001  -2.338803e-001   8.094870e-001
          4.345836e-001  -7.366578e-001  -5.181432e-001
          7.052152e-001  -5.433383e-001   4.554723e-001
         -8.973768e-001   3.366878e-001   2.852302e-001  ];
   nsteps = 2;
   dimmeas = [ 7  6];
else
   ff = input('Specify the input filename (with extension) -->  ','s');
   g = load(ff);
   disp('  ');
   nsteps = input('Specify the number of steps --> ');
   disp('  ');
   atext = 'Specify the number of measurements for step ';
   dtext = ' --> ';
   for k = 1:nsteps
      btext = num2str(k);
      ctext = [atext btext dtext];
      dimmeas(k) = input(ctext);
   end
   disp('  ');
end
[nrow,ncol] = size(g);

if nrow < 5
   disp('Error - XRAIMFD; there are fewer than 5 line-of-sights');
   disp('  ');
   return
end

%  Save computed results into an external file or display on screen

disp('Enter the output desired (datafile or on screen)');
answer2 = input('Do you want to display the results on screen? (y/n)[y] --> ','s');
if isempty(answer2)
   answer2 = yes;
end   
disp('  ');
if (strcmp(answer2,yes) == 1)
   f2 = 1;
else
   f2 = input('Specify the output filename (with extension) -->  ','s');
end
fprintf(f2,'**************************************************************\n');
fprintf(f2,'\n*****   Input data   ****** \n\n');
for k = 1:nrow
   fprintf(f2,'LOS # %2.0f --> %16.7f %16.7f %16.7f\n',k,g(k,1:3));
end
fprintf(f2,'\nProbability of false alarm   = %14.7f\n',pfa);
fprintf(f2,'Probability of missed detection  = %14.7f\n',pmd);
fprintf(f2,'Standard deviation of measurement noise (in meters) = %9.2f\n',...
            sigma);

fprintf(f2,'\n*****   Results by using XRAIMFD   ****** \n');
 
index = 1;
for k = 1:nsteps
   clear ggg
   indexf = index + dimmeas(k) - 1;

%  Determine fault detection flags

   ggg = g(index:indexf,:);
   counts = raimfd(ggg,pfa,sigma,pmd);
   index = indexf + 1;

%  Display/save the results (flags)

   fprintf(f2,'\n***  Step = %3.0f  ***  %3.0f  measurements  ***\n',k, dimmeas(k));
   fprintf(f2,'False Alarm Flag       =  %3.0f\n',counts(1));
   fprintf(f2,'True Alarm Flag        =  %3.0f\n',counts(2));
   fprintf(f2,'Missed Detection Flag  =  %3.0f\n',counts(3));
   fprintf(f2,'Normal Operation Flag  =  %3.0f\n',counts(4));
   fprintf(f2,'Unavailable Flag       =  %3.0f\n',counts(5));

end
fprintf(f2,'\n**************************************************************\n');

disp('  ');
disp('End of the program  XRAIMFD');
disp('  ');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -