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

📄 ssts__plot_orbit_position.m

📁 空间绳系卫星的仿真软件
💻 M
字号:
function [ error_status ] = SSTS__plot_orbit_position( distance_to_periapsis , eccentricity , orbits, step )

% /*M-FILE FUNCTION SSTS__plot_orbit_position MMM SSTSLAB */
% /*==================================================================================================
%  Simple Space Tether Simulation Laboratory Toolbox for Matlab 7.x
%
%  Copyright 2007 The SxLAB Family - Yi Chen - leo.chen.yi@gmail.com
% ====================================================================================================
%File description:
%       To plot the position function of orbits( cycles ) as following:
%       R(theta) = rp*(1+e)/(1+e*cos(theta))
%            where,
%                  rp - distance to periapsis, 6890km in default
%                   e - the magnitude of the eccentricity vector,which belong to [0,1]
% Input:
%  distance_to_periapsis -- the distance to periapsis or rp
%  eccentricity          -- eccentricity,    default 0.25
%  orbits                -- cycles numbers,  default 5
%  step                  -- simulations step,default 0.01
%
% Output:
%  error_status =  0     -- ok
%                 !0     -- fail
% Example :
% 
% >> SSTS__plot_orbit_position(7000)
% 
% ans =
% 
%      0
%===================================================================================================
%  See Also:   SSTS__plot_position3d
%
%===================================================================================================
%
%===================================================================================================
%Revision -
%Date        Name    Description of Change email                 Location
%27-Nov-2006 Yi Chen Initial version       leo.chen.yi@gmail.com Glasgow
%HISTORY$
%==================================================================================================*/

% SSTS__plot_orbit_position Begin

error_status = 0;
%% check input & error protect
if ( nargin == 0 )

    step                  = 0.01;
    orbits                = 5.0 ;
    eccentricity          = 0.25;
    distance_to_periapsis = 6890;%km

elseif( nargin == 1 ) % step in default

    step                  = 0.01;
    orbits                = 5.0 ;
    eccentricity          = 0.25;

elseif( nargin == 2 ) % step in default

    step                  = 0.01;
    orbits                = 5.0 ;

elseif( nargin == 3 ) % step in default

    step                  = 0.01;

elseif( nargin > 4 ) % step in default

    error ('SSTS__plot_orbit_position() Error: Input Parameters...');

    error_status = 1 ;

end

% calculating position
theta = 0:step:orbits*2*pi;
length_of_position = (distance_to_periapsis*(1+eccentricity))./(1+eccentricity*cos(theta));

%plot 
plot( theta/2/pi ,length_of_position,'LineWidth',2 );

%X,Y axis 
hold on
grid on

xlabel('Orbits(Cycles)');
ylabel('Position Length(km)');
title( 'R(\theta)=rp(1+e)/(1+ecos(\theta)');

% mark tags
text(0.0,distance_to_periapsis,...
'\leftarrow rp is the distance to periapsis');


% SSTS__plot_orbit_position End

⌨️ 快捷键说明

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