etheta2e.m

来自「It s verry good for you」· M 代码 · 共 31 行

M
31
字号
function E = etheta2E(e, th)
%ETHETA2E               Convert Kepler elements [e] and [theta] to [E].
%
%   ETHETA2E(e, theta) converts the Keplerian elements [e] and [theta] to
%   their corresponding eccentric anomaly [E]. In case [e] > 1, the value
%   for [E] is the hyperbolic anomaly [F].
%
%   See also aeM2rtheta, etheta2M.


% Author: Rody P.S. Oldenhuis
% Delft University of Technology
% E-mail: oldenhuis@dds.nl
% Last edited 13/Feb/2009
    
    % initialize E
    E = zeros(size(e));
    
    % seperate ellipses from hyperbolas
    ell = (e < 1);
    hyp = (e > 1);
    
    % output results    
    if any(ell(:))
        E(ell) = 2*atan2(sqrt(1-e(ell)).*sin(th(ell)/2), sqrt(1+e(ell)).*cos(th(ell)/2));
    end
    if any(hyp(:))
        E(hyp) = 2*atanh(sqrt( (e(hyp)-1) ./ (e(hyp)+1) ) .* tan(th(hyp)/2));
    end

end

⌨️ 快捷键说明

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