📄 ssts__plot_orbit_position3d.m
字号:
function [ error_status ] = SSTS__plot_orbit_position3d( distance_to_periapsis ,orbits, step )
% /*M-FILE FUNCTION SSTS__plot_orbit_position3d 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
% orbits -- cycles numbers, default 5
% step -- simulations step,default 0.01
%
% Output:
% error_status = 0 -- ok
% !0 -- fail
% Example :
%
% >> SSTS__plot_orbit_position3d(7000)
%
% ans =
%
% 0
%===================================================================================================
% See Also: SSTS__plot_orbit_position
%
%===================================================================================================
%
%===================================================================================================
%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_position3d Begin
error_status = 0;
%% check input & error protect
if ( nargin == 0 )
step = 0.01;
orbits = 5.0 ;
distance_to_periapsis = 6890;%km
elseif( nargin == 1 ) % step in default
step = 0.01;
orbits = 5.0 ;
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_position3d() Error: Input Parameters...');
error_status = 1 ;
end
eccentricity = 0:step:1;
theta = 0:step:orbits*2*pi;
length_of_position = zeros(length(theta),length(eccentricity));
% calculating position
for jdx = 1 : 1 : length(eccentricity)
for idx = 1 : 1 : length(theta)
length_of_position(idx,jdx) = (distance_to_periapsis*(1+eccentricity(jdx)))./(1+eccentricity(jdx)*cos(theta(idx)));
end
end
%plot
meshz(eccentricity,theta/2/pi,length_of_position);
colormap hsv
%X,Y,Z axis
xlabel('Eccentricity(e:0~1)');
ylabel('Orbits(cycles)');
zlabel('Position Length(km)');
title( 'R(\theta)=rp(1+e)/(1+ecos(\theta)');
% SSTS__plot_orbit_position3d End
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -