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

📄 xypc2rss.m

📁 GPS TOOLBOX包含以下内容: 1、GPS相关常量和转换因子; 2、角度变换; 3、坐标系转换: &#61656 点变换; &#61656 矩阵变换; &#61656 向量变换
💻 M
字号:
%                             xypc2rss.m
%  Scope:   This MATLAB program plots a x-y graph for root sum square (RSS) of
%           three specified columns from the difference of two ASCII data files; 
%           manual scaling is available. In addition, the plot can incorporate 
%           statistics related to the selected graph, i.e. mean, standard 
%           deviation and root mean square (rms).
%  Usage:   xypc2rss
%  Inputs:  - the name of the first ASCII input data file (with extension),
%           - the name of the second ASCII input data file (with extension),
%           - the selected x-axis column index,
%           - the columns number for the RSS plotting,
%           - title of the plot,
%           - y-axis label,
%           - x-axis label, 
%           - optional, new axes limits [xmin xmax ymin ymax].
%  Outputs: - selected graph
%  Remarks: The column used as x-axis is selected from the first input data 
%           file. The computed/listed statistics is for the selected range of 
%           the x-axis. The comparison can use the same file
%  External Matlab macros used:  rms
%  Last update:  08/23/00
%  Copyright (C) 1997-00 by LL Consulting. All Rights Reserved.

clear
close all

disp('  ');
fname1 = input('Specify the name of the first input data file (with extension) --> ','s');
hh1 = load(fname1);
[npt1,nmax1] = size(hh1);
if  nmax1 < 4
   disp('  ');
   disp('Error  -  XYPC2RSS; first input file has less than 4 columns');
   disp('  ');
   return
end

disp('  ');
fname2 = input('Specify the name of the second input data file (with extension) --> ','s');
hh2 = load(fname2);
[npt2,nmax2] = size(hh2);
if  nmax2 < 4
   disp('  ');
   disp('Error  -  XYPC2RSS; second input file has less than 4 columns');
   disp('  ');
   return
end

nmax = min(nmax1,nmax2); 
npt = min(npt1,npt2);
disp('  ');
index = input('Enter column number used as x-axis from first file --> ');
x = hh1(1:npt,index);            %  data from the first input file
hh = hh1(1:npt,1:nmax) - hh2(1:npt,1:nmax);

yes = 'y';
answer = 'y';
fignr = 0;
while (strcmp(answer,yes) == 1)
   fignr = fignr + 1;
   disp('  ');
   n1 = input('Enter the first column number for RSS plotting  -->  ');
   n2 = input('Enter the second column number for RSS plotting -->  ');
   n3 = input('Enter the third column number for RSS plotting  -->  ');
   disp('  ');
   clear y
   if ( (n1<=nmax) & (n1>=2) & (n2<=nmax) & (n2>=2) & (n3<= nmax)&(n3>=2) )
      y1 = hh(1:npt,n1);
      y2 = hh(1:npt,n2);
      y3 = hh(1:npt,n3);
      for k = 1:npt
          y(k) = sqrt(y1(k)*y1(k) + y2(k)*y2(k) + y3(k)*y3(k));
      end
      y = y';
      ymean = mean(y);
      ystd = std(y);
      yrms = rms(y);
      temp1 = ['mean = ',num2str(ymean)];
      temp2 = ['st.dev. = ',num2str(ystd)];
      temp3 = ['rms = ',num2str(yrms)];
      g = [temp1,' ;   ',temp2,' ;   ',temp3];
      aa = input('Enter title of the plot:  ','s');
      bb = input('Enter  Y  label:  ','s');
      cc = input('Enter  X  label:  ','s');
      xmin = min(x);
      xmax = max(x);
      ymin = min(y);
      ymax = max(y);
      disp('   ');
      disp('Place the text with statistics on the graph; ');
      temp = input('      Press <Enter> or <Return> key to start ... ');
      figure(fignr)
      plot(x,y),grid,...
      title(aa), ylabel(bb),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),
         redo_axes_limits = 1;
         while (redo_axes_limits == 1)
            fprintf('\nCurrent limits are: \n');
            fprintf('   xmin = %14.7f \n',xmin);
            fprintf('   xmax = %14.7f \n',xmax);
            fprintf('   ymin = %14.7f \n',ymin);
            fprintf('   ymax = %14.7f \n',ymax);
            disp('  ');
            axes_limits = input('Enter axes limits [xmin xmax ymin ymax]:  ');
            xmin = axes_limits(1);
            xmax = axes_limits(2);
            ymin = axes_limits(3);
            ymax = axes_limits(4);
            fprintf('\nSelected limits are: \n');
            fprintf('   xmin = %14.7f \n',xmin);
            fprintf('   xmax = %14.7f \n',xmax);
            fprintf('   ymin = %14.7f \n',ymin);
            fprintf('   ymax = %14.7f \n',ymax);
            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 xnew;
         clear ynew;
         kk = 0;
         for k = 1:npt
            if ((x(k) >= xmin) & (x(k) <= xmax)),
               kk = kk + 1;
               xnew(kk) = x(k);
               ynew(kk) = y(k);
            end
         end 
         xnew = xnew'; 
         ynew = ynew';
         ymean = mean(ynew);
         ystd = std(ynew);
         yrms = rms(ynew);
         temp1 = ['mean = ',num2str(ymean)];
         temp2 = ['st.dev. = ',num2str(ystd)];
         temp3 = ['rms = ',num2str(yrms)];
         g = [temp1,' ;   ',temp2,' ;   ',temp3];
         disp('   ');
         disp('Place the text with statistics on the graph; ');
         temp = input('      Press <Enter> or <Return> key to start ... ');
         fignr = fignr + 1;
         figure(fignr)
         plot(xnew,ynew), grid,...
         axis([xmin xmax ymin ymax]),...
         title(aa), ylabel(bb), xlabel(cc),...
         gtext(g)           %  mouse placement of the text on a graph
         disp('   ');
         temp = input('Press <Enter> or <Return> key to continue ... ');
      end
   else
      disp('Column(s) is(are) not in the range; check the selection ...');
      temp = ['The column range is: 1 to  ',num2str(nmax)];
      disp(temp);
   end
   disp('  ');
   answer = input('Do you want another plot? (y/n)[n] ','s');
end
disp('  ');
disp('End of the program  XYPC2RSS ');
disp('  ');

⌨️ 快捷键说明

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