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

📄 xyprss2w.m

📁 GPS TOOLBOX包含以下内容: 1、GPS相关常量和转换因子; 2、角度变换; 3、坐标系转换: &#61656 点变换; &#61656 矩阵变换; &#61656 向量变换
💻 M
字号:
%                             xyprss2w.m
%  Scope:   This MATLAB program plots a x-y graph for root sum square (RSS) of
%           three columns corresponding to the position and velocity errors
%           from an ASCII data file; manual scaling is available. 
%           In addition, the plots can incorporate statistics related to the 
%           selected graphs, i.e. mean, standard deviation and root mean square 
%           rms).
%  Usage:   xyprss2w
%  Inputs : - the name of the ASCII input data file (with extension),
%           - title of the plot,
%           - optional, new axes limits [xmin xmax ymin ymax] for both plots.
%  Outputs: - selected graphs
%  Remark:  The first column of the input array contains the  x  coordinates,
%           columns 2 to 4 contain position error components, and columns 5 to 
%           7 contain velocity error components. The units used in the legend 
%           are: seconds, meters, and meters/second.
%           The computed/listed statistics is for the selected range of the
%           specified plot.
%           The program can be easily modified to allow the selection of columns
%           for x and y axes.
%  External Matlab macros used:  rms
%  Last update:  08/23/00
%  Copyright (c) 1997-00 by LL Consulting. All Rights Reserved.

clear
close all

% Read the input data file

disp('  ');
fname = input('Specify the name of the input data file (with extension) --> ','s');
hh = load(fname);
[npt,nmax] = size(hh);
if  nmax < 7
   disp('  ');
   disp('Error  -  XYPRSS2W; ASCII input file has less than 7 columns');
   disp('  '); 
end
x = hh(1:npt,1);

yes = 'y';

% Execute the RSS position error plot (first plot)

xp = x;
y1 = hh(1:npt,2);
y2 = hh(1:npt,3);
y3 = hh(1:npt,4);
for k = 1:npt
    yp(k) = sqrt(y1(k)*y1(k) + y2(k)*y2(k) + y3(k)*y3(k));
end
yp = yp';
ypmean = mean(yp);
ypstd = std(yp);
yprms = rms(yp);
temp1 = ['mean = ',num2str(ypmean)];
temp2 = ['st.dev. = ',num2str(ypstd)];
temp3 = ['rms = ',num2str(yprms)];
g = [temp1,' ;   ',temp2,' ;   ',temp3];
disp('  ');
aap = input('Enter title of the plots :  ','s');
bbp = 'RSS Pos. Error, in m.';
cc = 'Time, in seconds';
xpmin = min(xp);
xpmax = max(xp);
ypmin = min(yp);
ypmax = max(yp);
disp('   ');
disp('Place the text with statistics on the graph; ');
temp = input('      Press <Enter> or <Return> key to start ... ');
figure(1)
subplot(211),plot(xp,yp),grid,...
title(aap), ylabel(bbp),xlabel(cc)
gtext(g)           %  mouse placement of the text on a graph
disp('   ');
temp = input('Press <Enter> or <Return> key to continue ... ');

% Execute the RSS velocity error plot (second plot)

xv = x;
y1 = hh(1:npt,5);
y2 = hh(1:npt,6);
y3 = hh(1:npt,7);
for k = 1:npt
    yv(k) = sqrt(y1(k)*y1(k) + y2(k)*y2(k) + y3(k)*y3(k));
end
yv = yv';
yvmean = mean(yv);
yvstd = std(yv);
yvrms = rms(yv);
temp1 = ['mean = ',num2str(yvmean)];
temp2 = ['st.dev. = ',num2str(yvstd)];
temp3 = ['rms = ',num2str(yvrms)];
g = [temp1,' ;   ',temp2,' ;   ',temp3];
aav = '   ';
bbv = 'RSS Vel. Error, in m/s';
cc = 'Time, in seconds';
xvmin = min(xv);
xvmax = max(xv);
yvmin = min(yv);
yvmax = max(yv);
disp('   ');
disp('Place the text with statistics on the graph; ');
temp = input('      Press <Enter> or <Return> key to start ... ');
subplot(212),plot(xv,yv),grid,...
title(aav), ylabel(bbv),xlabel(cc)
gtext(g)           %  mouse placement of the text on a graph
disp('   ');
temp = input('Press <Enter> or <Return> key to continue ... ');
disp('  ');

%  Select manual scaling for both axes

manscaleq = input('Do you want manual scaling? (y/n)[n] ','s');
if (strcmp(manscaleq,yes) == 1),

%  Select new axes for the first plot
 
   redo_axes_limits = 1;
   while (redo_axes_limits == 1)
      fprintf('\nCurrent limits for the first plot are: \n');
      fprintf('   xpmin = %14.7f \n',xpmin);
      fprintf('   xpmax = %14.7f \n',xpmax);
      fprintf('   ypmin = %14.7f \n',ypmin);
      fprintf('   ypmax = %14.7f \n',ypmax);
      disp('  ');
      axes_limits = input('Enter axes limits [xpmin xpmax ypmin ypmax]:  ');
      xpmin = axes_limits(1);
      xpmax = axes_limits(2);
      ypmin = axes_limits(3);
      ypmax = axes_limits(4);
      fprintf('\nSelected limits for the first plot are: \n');
      fprintf('   xpmin = %14.7f \n',xpmin);
      fprintf('   xpmax = %14.7f \n',xpmax);
      fprintf('   ypmin = %14.7f \n',ypmin);
      fprintf('   ypmax = %14.7f \n',ypmax);
      disp('  ');
      newlimq = input('Do you want to change axes limits? (y/n)[n] ','s');
         if (strcmp(newlimq,yes) == 0),
             redo_axes_limits = 0;
         end
  end
  clear xpnew;
  clear ypnew;
  kk = 0;
  for k = 1:npt
      if ((xp(k) >= xpmin) & (xp(k) <= xpmax)),
          kk = kk + 1;
          xpnew(kk) = xp(k);
          ypnew(kk) = yp(k);
      end
  end 
  xpnew = xpnew'; 
  ypnew = ypnew';
  ypmean = mean(ypnew);
  ypstd = std(ypnew);
  yprms = rms(ypnew);
  temp1 = ['mean = ',num2str(ypmean)];
  temp2 = ['st.dev. = ',num2str(ypstd)];
  temp3 = ['rms = ',num2str(yprms)];
  g = [temp1,' ;   ',temp2,' ;   ',temp3];
  disp('   ');
  disp('Place the text with statistics on the graph; ');
  temp = input('      Press <Enter> or <Return> key to start ... ');
  figure(2)
  subplot(211),plot(xpnew,ypnew), grid,...
  axis([xpmin xpmax ypmin ypmax]),...
  title(aap), ylabel(bbp), xlabel(cc),...
  gtext(g)           %  mouse placement of the text on a graph
  disp('   ');
  temp = input('Press <Enter> or <Return> key to continue ... ');


%  Select new axes for the second plot
 
  redo_axes_limits = 1;
  while (redo_axes_limits == 1)
     fprintf('\nCurrent limits for the second plot are: \n');
     fprintf('   xvmin = %14.7f \n',xvmin);
     fprintf('   xvmax = %14.7f \n',xvmax);
     fprintf('   ymin = %14.7f \n',yvmin);
     fprintf('   ymax = %14.7f \n',yvmax);
     disp('  ');
     axes_limits = input('Enter axes limits [xvmin xvmax yvmin yvmax]:  ');
     xvmin = axes_limits(1);
     xvmax = axes_limits(2);
     yvmin = axes_limits(3);
     yvmax = axes_limits(4);
     fprintf('\nSelected limits for the second plot are: \n');
     fprintf('   xvmin = %14.7f \n',xvmin);
     fprintf('   xvmax = %14.7f \n',xvmax);
     fprintf('   yvmin = %14.7f \n',yvmin);
     fprintf('   yvmax = %14.7f \n',yvmax);
     disp('  ');
     newlimq = input('Do you want to change axes limits? (y/n)[n] ','s');
     if (strcmp(newlimq,yes) == 0),
         redo_axes_limits = 0;
     end
  end
  clear xvnew;
  clear yvnew;
  kk = 0;
  for k = 1:npt
     if ((xv(k) >= xvmin) & (xv(k) <= xvmax)),
         kk = kk + 1;
         xvnew(kk) = xv(k);
         yvnew(kk) = yv(k);
     end
  end 
  xvnew = xvnew'; 
  yvnew = yvnew';
  yvmean = mean(yvnew);
  yvstd = std(yvnew);
  yvrms = rms(yvnew);
  temp1 = ['mean = ',num2str(yvmean)];
  temp2 = ['st.dev. = ',num2str(yvstd)];
  temp3 = ['rms = ',num2str(yvrms)];
  g = [temp1,' ;   ',temp2,' ;   ',temp3];
  disp('   ');
  disp('Place the text with statistics on the graph; ');
  temp = input('      press <Enter> or <Return> key to start ... ');
  subplot(212),plot(xvnew,yvnew), grid,...
  axis([xvmin xvmax yvmin yvmax]),...
  title(aav), ylabel(bbv), xlabel(cc),...
  gtext(g)           %  mouse placement of the text on a graph
  disp('   ');
  temp = input('      press <Enter> or <Return> key to continue ... ');
  disp('   ');
end

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

⌨️ 快捷键说明

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