File size: 3,843 Bytes
5ab75a9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
function [Li,Lpi,Fi,Di,OMi,S1i,S2i,C1i,C2i] = Nutation1980(NUTModel)
% Nutation1980 - This function reads nutation model information (1980) and
%                returns relevant data to be used in the angles computation 
%                for the rotation nutation matrix.
%
% Syntax: [Li,Lpi,Fi,Di,OMi,S1i,S2i,C1i,C2i] = Nutation1980(NUTModel);
%
% =========================================================================
%
% Copyright (c) 2023 United States Government as represented by the
% Administrator of the National Aeronautics and Space Administration.
% All Rights Reserved.
%
% =========================================================================
%
% Input:
%
%   NUTModel    -   Choose the number of terms in the nutation model
%                       (Format: '4terms', '10terms', or '106terms')
%
% =========================================================================
%
% Output:
%
%   [Li,Lpi,Fi,Di,OMi,S1i,S2i,C1i,C2i]  -   Vector of various quantities 
%                                           found in the nutation model 
%                                           file to be used for angles 
%                                           computation of the nutation
%                                           matrix. 
%
% =========================================================================
% 
% Dependenices:
%
%   Nutation1980.mat
%
% =========================================================================
%
% Initial version: Feb 2013;  Latest update: Jul 2023
%
% ----------------- BEGIN CODE -----------------

    % Nutation data
    persistent NUT1980Info;
    
     if (isempty(NUT1980Info))
        % Get nutation info (106 terms) from a .mat file
        [p,~,~] = fileparts(mfilename('fullpath'));
        nutFile = fullfile(p, 'Nutation1980.mat');
        load(nutFile,'NUT1980Info');
     end
    
    % If user specified 4-term Nutation model
    if (strcmp(NUTModel,'4terms') == 1)
        NUT1980 = NUT1980Info(1:4,:);
    % If user specified 10-term Nutation model
    elseif (strcmp(NUTModel,'10terms') == 1)
        NUT1980 = NUT1980Info(1:10,:);
    % If user specified 106-term Nutation model
    elseif (strcmp(NUTModel,'106terms') == 1)
        NUT1980 = NUT1980Info;
    % If user specified other model
    else
        error('Nutation1980:InvalidModel', 'Invalid nutation model (valid models are 4terms, 10terms, and 106terms)');
    end

    % Astronomical Almanac (p. 112-113)
    Li  = NUT1980(:,1);
    Lpi = NUT1980(:,2);
    Fi  = NUT1980(:,3);
    Di  = NUT1980(:,4);
    OMi = NUT1980(:,5);
    
    % Provided in 1e-4 arcseconds
    S1i = NUT1980(:,7)  * 1e-4;
    S2i = NUT1980(:,8)  * 1e-4;   
    C1i = NUT1980(:,9)  * 1e-4;   
    C2i = NUT1980(:,10) * 1e-4; 

return

% ----------------- END OF CODE ------------------
%
% Please record any changes to the software in the change history 
% shown below:
%
%---------------- CHANGE HISTORY ------------------
% Developer      |    Date    |     Description
%--------------------------------------------------
% D. Plakalovic  | 07-13-2015 | Re-coded this function from the original 
%                               version (Feb 2013). Inserted additional
%                               functionality.
% L. Baars       | 10-18-2022 | Updated to remove global variables.
% E. White       | 07-12-2023 | Added compliant documentation, added 10term
%                               nutation option

% =========================================================================
%
% Copyright (c) 2023 United States Government as represented by the
% Administrator of the National Aeronautics and Space Administration.
% All Rights Reserved.
%
% =========================================================================