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

📄 xuposd4.m

📁 GPS TOOLBOX包含以下内容: 1、GPS相关常量和转换因子; 2、角度变换; 3、坐标系转换: &#61656 点变换; &#61656 矩阵变换; &#61656 向量变换
💻 M
字号:
%                                xuposd4.m
%  Scope:   This MATLAB program computes GPS user's position by using a direct
%           (non-iterative) GPS solution method proposed by Bancroft [1], [2],
%           when four ECEF satellite positions and the corresponding pseudo-
%           ranges are known.
%  Usage:   xuposd4
%  Inputs:  - name of the output file if selected, otherwise the data are
%             displayed on screen
%           - name of the ASCII input file with four rows and four columns; 
%             each row contains the three components of the ECEF satellite 
%             position and the corresponding pseudorange (all values are in
%             meters)
%  Outputs: - input data, ECEF position and corresponding pseudorange for
%             each satellite
%           - computed ECEF user's position and computed user's clock bias
%             measurement in units of distance (for each solution)
%  External Matlab macros used:  uposd4
%  References:
%           [1] Bancroft, S., An algebraic solution of the GPS equations.
%               IEEE Transactions on Aerospace and Electronic Systems, vol.
%               AES-21, No. 7, 1985, pp. 56-59.
%           [2] Chaffee, J. W., Abel, J. S., Bifurcation of pseudorange 
%               equations. Institute of Navigation, Proceedings of the 1993 
%               National Technical Meeting, San Francisco, CA, Jan. 20-22,
%               1993, pp. 203-211.
%  Last update:  08/24/00
%  Copyright (C) 1996-00 by LL Consulting. All Rights Reserved.

clear  
yes = 'y';

%  Specify the output file if selected

disp(' ');
answer1 = input('Do you want to save the results? (y/n)[n] --> ','s');
if isempty(answer1)
   answer1 = 'n';
end   
disp(' ');
if (strcmp(answer1,yes) == 1)
   f2 = input('Specify the output filename (with extension) -->  ','s');
   disp(' ');
else
   f2 = 1;      %  output to the screen
end

answer2 = yes;
while (strcmp(answer2,yes) == 1)
   clear  tt
   disp('Enter satellite+pseudorange input data - the default is sv4posr.dat');
   answer3 = input('Do you want to use the default data file? (y/n)[y] ','s');
   if isempty(answer3)
      answer3 = yes;
   end   
   if (strcmp(answer3,yes) == 1)
      f1 = 'sv4posr.dat';
   else
      disp('  ');
      f1 = input('Specify the input filename (with extension) --> ','s');
   end
   disp('  ');
   
%  Read the input data file

   tt = load(f1);
   [nrow,ncol] = size(tt);

   if  (ncol ~= 4) | (nrow ~= 4)
      disp('Error1 - XUPOSD4; check the input data - row/column number');
      disp('The input file should have 4 rows and 4 columns');
      disp('  ');
      disp('End of the program  XUPOSD4 ');
      disp('  ');
      return
   end

   svpos = tt(1:4,1:3);
   rho = tt(1:4,4);

%  Write input data

   fprintf(f2,'********************************  INPUT  DATA  ************');
   fprintf(f2,'********************\n\n');
   for  k = 1:4
      fprintf(f2,'For SV # %3.0f \n',k);
      fprintf(f2,'   *****  ECEF position (in meters) :\n');
      fprintf(f2,'%20.7f  %20.7f  %20.7f\n',svpos(k,1),svpos(k,2),svpos(k,3));
      fprintf(f2,'   *****  Pseudorange (in meters) :\n');
      fprintf(f2,'%20.7f\n\n',rho(k));
    end

%  Compute user's ECEF position

   [nsol,upos,ucbias] = uposd4(svpos,rho);

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

   fprintf(f2,'*******************************  RESULTS  *****************');
   fprintf(f2,'********************\n\n');
   if  nsol == 0
      fprintf(f2,'There are no GPS solutions \n\n');
   elseif  nsol == 1   
      fprintf(f2,'Computed user"s ECEF position (in meters) :\n');
      fprintf(f2,'%20.7f  %20.7f  %20.7f  \n\n',upos(1),upos(2),upos(3));
      fprintf(f2,'Computed user"s clock bias measured in units of distance ');
      fprintf(f2,' (in meters) :\n %24.14f \n\n',ucbias);
   elseif  nsol == 2
      fprintf(f2,'****  First GPS solution \n');
      fprintf(f2,'Computed user"s ECEF position (in meters) :\n');
      fprintf(f2,'%20.7f  %20.7f  %20.7f  \n\n',upos(1),upos(2),upos(3));
      fprintf(f2,'Computed user"s clock bias measured in units of distance ');
      fprintf(f2,' (in meters) :\n %24.14f \n\n',ucbias);
      fprintf(f2,'****  Second GPS solution \n');
      fprintf(f2,'Computed user"s ECEF position (in meters) :\n');
      fprintf(f2,'%20.7f  %20.7f  %20.7f  \n\n',upos(1),upos(2),upos(3));
      fprintf(f2,'Computed user"s clock bias measured in units of distance ');
      fprintf(f2,'(in meters) :\n %24.14f \n\n',ucbias);
   else
      disp('Error2 - XUPOSD4; check the output data "nsol" from uposd4');
      disp('  ');
      disp('End of the program  XUPOSD4 ');
      disp('  ');
      return
   end
   fprintf(f2,'***********************************************************');
   fprintf(f2,'********************\n\n');

%  Select another computation, if desired

   answer2 = input('Do you want another computation? (y/n)[n] --> ','s');
   if  isempty(answer2)
      answer2 = 'n';
   end
   disp('  ');

end

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

⌨️ 快捷键说明

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