📄 ssts__tether_mmet_ii_u_energy_plot.m
字号:
function [ error_status ] = SSTS__tether_MMET_II_U_energy_plot( R, L,psi,ro,A,MM,MP,N )
% /*M-FILE Function SSTS__tether_MMET_II_U_energy_plot 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 avoid ln( ) function's singularity at psi = pi, an alternativ
% description of the potential energy of MMET-II is derived, which
% discretises the tether mass into point masses
%
% Input:
% MP - mass of payload;
% MM - mass of motor x
% R - distance from the earth center to motor mass
% L - length of tether
% psi - angle of tether rotating
% ro - density of tether
% A - area of tether
%
% Output:
% error_status 0 -- ok
% !0 -- fail
%===================================================================================================
% See Also: SSTS__plot_position3d
% SSTS__plot_position
% SSTS__tether_dumbbell_replot
% SSTS_ln_function_singularity_replot
%===================================================================================================
%
%===================================================================================================
%Revision -
%Date Name Description of Change email Location
%30-Nov-2006 Yi Chen Initial version leo.chen.yi@gmail.com Glasgow
%HISTORY$
%==================================================================================================*/
% SSTS__tether_MMET_II_U_energy_plot Begin
error_status = 0 ;
if ( nargin == 0 )
SSTS__clear;
mu = 3.9877848*10^14;
ro = 1;
A = 1000;
L = 100;
psi = 0.1;
MP = 500;
MM = 100;
R = 6890000;
N = 25;
end
if( nargin ~= 8 & nargin~= 0 ) % step in default
error_status = 1;
error ('SSTS__tether_MMET_II_U_energy_plot() Error: Input Parameters...');
end
U_con = -mu*MP*small_funcs(R,L,psi,'+')...
-mu*MP*small_funcs(R,L,psi,'-')...
-mu*MM/R ...
+mu*ro*A*ln( R, L, psi );
U_dis = zeros(1,N);
U_con = ones(1,N)*U_con;
error_data = zeros(1,N);
for idx = 1 : 1 : N
U_dis(idx) = -mu*MP*small_funcs( R, L, psi,'+')...
-mu*MP*small_funcs( R, L, psi,'-')...
-mu*MM/R...
+ mu*ro*A*L.*sum_point_mass( R , L , psi , idx );
error_data(idx) = U_dis(idx) - U_con(idx);
end
points = 1 : 1 : N;
figure(1)
grid on
hold on
plot( points,U_con,'b.-',points,U_dis,'ro-' );
xlabel('N number of mass points');
ylabel('Potential Energy of MMET-II ');
title('Full vs. Discrete tether Potential Energy');
legend('full-tether','discrete-tether');
figure(2)
grid on
hold on
plot( points,error_data );
xlabel('N number of mass points');
ylabel('error in Potential Energy of MMET-II ');
title('Error of Full vs. Discrete tether Potential Energy');
% SSTS__tether_MMET_II_U_energy_plot End
function [ out ] = small_funcs(R,L,psi,option )
if ( option == '+')
out = ( R^2 + L^2 + 2*L*R*cos(psi) )^(-1/2);
elseif( option == '-')
out = ( R^2 + L^2 - 2*L*R*cos(psi) )^(-1/2);
else
out = NaN;
error( 'check the input of big_block()');
end
%%sub func - 1
function [ ln_out ] = ln( R , L , psi )
ln_out = log( ( R.*cos(psi)- L + sqrt( R^2 + L^2 - 2*L*R.*cos(psi) ))./( R.*cos(psi)+ L + sqrt( R^2 + L^2 + 2*L*R.*cos(psi) )));
%%sub func - 2
function [ point_out ] = sum_point_mass( R , L , psi , N )
point_out = 0;
for idx = 1 : 1 : N
single = -( (N*sqrt( R^2 + ( (2*idx-1)*L/2/N )^2 + ( (2*(2*idx-1)*R*L)/2/N)*cos(psi)))^(-1)) - ...
(N*sqrt(R^2 + ( (2*idx-1)*L/2/N )^2 - ( (2*(2*idx-1)*R*L)/2/N)*cos(psi)))^(-1);
point_out = single + point_out;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -