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

📄 xmpath.m

📁 GPS TOOLBOX包含以下内容: 1、GPS相关常量和转换因子; 2、角度变换; 3、坐标系转换: &#61656 点变换; &#61656 矩阵变换; &#61656 向量变换
💻 M
字号:
%                                    xmpath.m
%  Scope:   This MATLAB program generates and saves the multipath pseudorange 
%           errors for a specified number of satellites and time steps.
%  Usage:   xmpath
%  Inputs:  - from keyboard the user should enter the following data: 
%             - maximum number of satellites used, nrsv (default is 12)
%             - number of time steps to be generated, nrstep (default is 1800)
%             - random number seed value (default is 0)
%           - selection of the storage data file
%             - mpfile.mat 
%             - selected name for ASCII data file
%             - none, no storage (default)
%           - selection of multipath plots from generated data
%             - satellite(s) number for which the generated data is plotted
%           - application specific parameters are initialized by default (see
%             sigma, order and wn) and time step is 1 second
%  Outputs: - output file storing the generated multipath pseudorange errors,
%             mat-file mpfile.mat or defined ASCII data file; the output array has
%             nrstep rows and nrsv columns, each row contains multipath data for 
%             a specific time step and all selected satellites
%           - plot of multipath pseudorange errors versus time step, for specified
%             satellites 
%  External Matlab macros used:  rms
%  Reference: [1] Hofman-Wellenhof, B., Lichtenegger, H., Collins, J., Global 
%                 Positioning System. Theory and Practice. Springer-Verlag, 1997
%  Last update:  01/17/01
%  Copyright (C) 1999-01 by LL Consulting. All Rights Reserved.

clear
close all
yes = 'y';

disp('  ');
nrsv = input('Enter maximum number of satellites used, nrsv (default is 12) -- >  ');
if isempty(nrsv)
   nrsv = 12;
end   
disp('  ');
nrstep = input('Enter number of steps to be generated, nrstep (default is 1800) -- >  ');
if isempty(nrstep)
   nrstep = 1800;
end   
disp('  ');
mpath = zeros(nrstep,nrsv);

%  Selection of random number seed

xseed = input('Enter random number seed value (default is 0.)  -- >  ');
if isempty(xseed)
   xseed = 0.;
end   
disp('  ');
randn('seed',xseed);

%  Initialization  (depending on specific application)

sigma = 10;
order = 1;      %  low pass Butterworth filter order
wn =  0.01;     %  cutoff frequency  between 0 and 1

%  Determine multipath data

[b,a] = butter(order,wn);
for kk = 1:nrsv
   x = sigma * randn(nrstep,1);
   y = filter(b,a,x);
   mpath(:,kk) = y;
end

%  Store the multipath generated data into mpfile.mat or selected ASCII data file

disp('Specify where you want to save the generated data ');
disp('     Enter  1   for the file mpfile.mat');
disp('     Enter  2   for the ASCII data file to be selected');
disp('     Enter  3   for NOT saving');
answer2 = input('Enter your selection  (default is 3) -- >  ');
if isempty(answer2)
   answer2 = 3;
end   
if  (answer2 == 1)
   save   mpfile  mpath
elseif  (answer2 == 2)
   f2 = input('Enter the multipath ASCII data file (with extension) -- > ','s');
   for k = 1:nrstep
      for  kk = 1:nrsv
         fprintf(f2,'%14.7e  ',mpath(k,kk));
      end
      fprintf(f2,'\n'); 
   end
else
    fprintf('\nThe generated data is NOT saved\n');
end
 
 %  Execute plots of generated multipath data
 
disp('  ');
answer1 = input('Execute plots of generated multipath data? (y/n)[y] ','s');
disp('  ');
if isempty(answer1)
   answer1 = yes;
end   
k = 1;
x = 1:nrstep;
while (strcmp(answer1,yes))
   sat_sel = input('Select the sateliite number (1 to nrsv) -->  ');
   if ((sat_sel < 1) | (sat_sel > nrsv))
      fprintf('Selection is not in range\n\n');
      disp('  ');
      return
   end   
   disp('  ');
   y = mpath(:,sat_sel);
   xmean = mean(y);
   xstd = std(y);
   xrms = rms(y);
   temp1 = ['mean = ',num2str(xmean)];
   temp2 = ['st.dev. = ',num2str(xstd)];
   temp3 = ['rms = ',num2str(xrms)];
   g = [temp1,' ;   ',temp2,' ;   ',temp3];
   disp('Execute random numbers graph - ');
   disp('Select the mouse position to insert statistics.');
   disp('Press a key to continue...');
   pause
   figure(k)
   plot(x,y), grid
   xlabel('Time step number');
   ylabel('Multipath pseudorange errors, in meters');
   aa = 'Multipath pseudorange errors  versus  Time step, for satellite number ';
   title([aa num2str(sat_sel)]); 
   gtext(g);                   %  mouse placement of the text on a graph
   disp('  ');
   disp('Random numbers graph - check the window associated to this figure.');
   disp('Press a key to continue...');
   disp('  ');
   pause
   answer1 = input('Do you want to execute another plot? (y/n)[n] --> ','s');
   if isempty(answer1)
      answer1 = 'n';
   end
   k = k + 1;
   disp('  ');
end

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

⌨️ 快捷键说明

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