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

📄 smarg.m

📁 航天工程工具箱
💻 M
字号:
function [marg,state,msg]=smarg(comp,lim)
%SMARG  Rocket flight stability margin.
%   [MARG,STATE,MSG] = SMARG(COMP[,LIM])  returns the stability
%   margin for a rocket design with components COMP (see EVALCP
%   and EVALCG for further details) given the stability limits
%   defined by the two element vector LIM (LIM = [1 5] by default),
%   expressed in units of the largest caliber of the rocket.
%
%   If the margin MARG is less than LIM(1), the rocket is
%   unstable and STATE = -1.
%   If MARG is greater than LIM(1) but less than LIM(2),
%   the rocket is stable and STATE = 0.
%   If MARG is greater than LIM(2), the rocket is overstable and
%   STATE = 1.
%
%   The output MSG is a string with the stability status which can
%   be either of 'Unstable', 'Stable' or 'Overstable'.
%
%   See also EVALCP, EVALCG, RCKPLOT, RCKCAD.

% Copyright (c) 2003-07-23, B. Rasmus Anthin.

if nargin<2, lim=[1 5];end
cg=evalcg(comp);
cp=evalcp(comp);
dmax=max(comp(:,6)+comp(:,6).*(comp(:,1)==4));
marg=(cp-cg)/dmax;
if marg<lim(1)
   state=-1;
   msg='Unstable';
elseif lim(1)<=marg & marg<lim(2)
   state=0;
   msg='Stable';
else
   state=1;
   msg='Overstable';
end

⌨️ 快捷键说明

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