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

📄 angl.m

📁 NORAD公布的两行星历数据计算轨道参数模型
💻 M
字号:
% ------------------------------------------------------------------------------
%
%                            function angl
%
%  this function calculates the angle between two vectors.  the output is
%    set to 999999.1 to indicate an undefined value.  be sure to check for
%    this at the output phase.
%
%  author        : david vallado                  719-573-2600   27 may 2002
%
%  revisions
%    vallado     - fix tolerances                                 5 sep 2002
%
%  inputs          description                    range / units
%    vec1        - vector number 1
%    vec2        - vector number 2
%
%  outputs       :
%    theta       - angle between the two vectors  -pi to pi
%
%  locals        :
%    temp        - temporary real variable
%
%  coupling      :
%
% [theta] = angl ( vec1,vec2 );
% ----------------------------------------------------------------------------- }

function [theta] = angl ( vec1,vec2 );

        small     = 0.00000001;
        undefined = 999999.1;

        magv1 = mag(vec1);
        magv2 = mag(vec2);

        if magv1*magv2 > small^2
            temp= dot(vec1,vec2) / (magv1*magv2);
            if abs( temp ) > 1.0
                temp= sign(temp) * 1.0;
              end
            theta= acos( temp );
          else
            theta= undefined;
          end

⌨️ 快捷键说明

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