xgpslsec.m

来自「GPS software toolbox for GPS receiver de」· M 代码 · 共 63 行

M
63
字号
%                                 xgplsec.m
%  Scope:   This MATLAB program determines the UTC leap seconds value for a 
%           specified year between 1980 and 2059; after the year 1999 the leap 
%           second value is only an estimate, and linear interpolation between 
%           values is recommended.
%  Usage:   xgpslsec
%  Inputs:  - name of the output file if selected (the default is the screen)
% 	         - year value (between 1980 and 2059)
%  Outputs: - input/output data stored into the specified output file or
%             displayed on screen
%           - plot of UTC leap seconds (for the period 1980-2000) versus year
%             (optional)
%  Last update:  04/16/00
%  Copyright (C) 1999-00 by LL Consulting. All Rights Reserved.

clear
close all

yes = 'y';
answer = 'y';

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

while (strcmp(answer,yes) == 1)

   year = input('Enter the year --> ');
   disp('  ');
   xoutput = gpslsec(year);

   fprintf(f2,'The UTC leap seconds value is %3.0f  for the year  %4.0f\n\n',...
               xoutput, year);

%  Select another computation, if desired

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

end

answer2 = input('Do you want a plot of 1980-2000 UTC leap seconds? (y/n)[n] --> ','s');
disp(' ');
if (strcmp(answer2,yes) == 1)
   x = 1980:0.05:2000;
   for k = 1:length(x)
      y(k) = gpslsec(x(k));
   end   
   plot(x,y), grid
   xlabel('Year'), title('UTC leap seconds  versus year'),
   ylabel('UTC leap seconds, in seconds'); 
   disp(' ');
end

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

⌨️ 快捷键说明

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