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

📄 actrim.m

📁 matlab的FDC工具箱
💻 M
📖 第 1 页 / 共 3 页
字号:
      V = 45;   end   H = input('Give (initial) altitude [m], default = 0: ');   if isempty(H)      H = 0;   end   psi  = input('Give heading [deg], default = 0: ')*pi/180;   if isempty(psi)      psi = 0;   end
   ok = 0;
   while ok~= 1      gammatype = input('Use specified manifold pressure or flight-path angle ([m]/f)? ','s');      if isempty(gammatype)         gammatype = 'm';      end      if gammatype == 'f'         gamma = input('Give flightpath angle [deg], default = 0: ')*pi/180;         if isempty(gamma)            gamma = 0;            ok = 1;
         end      elseif gammatype == 'm'
         ok = 1;
      else
         disp('   Invalid entry. Please choose either ''m'', or ''f''');
      end   end
      
   phidot   = 0;   psidot   = 0;   thetadot = 0;   rolltype = 'b';   % No rolling, so for reasons of simplicity the default setting,                      % i.e. a body-axes roll, will be used.elseif opt == 2                                       % STEADY TURNING FLIGHT                                                      % ---------------------   clc   disp('Steady turning flight.');   disp('======================');   ok = 0;   while ok~= 1
      turntype = input('Do you want a coordinated or uncoordinated turn ([c]/u)? ','s');      if isempty(turntype)         turntype = 'c';      end      if turntype == 'c' | turntype == 'u'
         ok = 1;
      else
         disp('   Invalid entry. Please choose either ''c'', or ''u''');
      end
   end
   V = input('Give desired airspeed [m/s], default = 45: ');   if isempty(V)      V = 45;   end   H = input('Give initial altitude [m], default = 0: ');   if isempty(H)      H = 0;   end   psi = input('Give initial heading [deg], default = 0: ')*pi/180;   if isempty(psi)      psi = 0;   end
   ok = 0;
   while ok~= 1
      gammatype = input('Use specified manifold pressure or flight-path angle ([m]/f)? ','s');
      if isempty(gammatype)
         gammatype = 'm';
      end
      if gammatype == 'f'
         gamma = input('Give flightpath angle [deg], default = 0: ')*pi/180;
         if isempty(gamma)
            gamma = 0;
            ok = 1;
         end
      elseif gammatype == 'm'
         ok = 1;
      else
         disp('   Invalid entry. Please choose either ''m'', or ''f''');
      end
   end
   phidot = 0;   thetadot = 0;
   ok = 0;
   while ok~= 1
      answ = input('Use specified turnrate or radius ([t]/r)? ','s');       if isempty(answ)
         answ = 't';
      end
      if answ == 't'         psidot = input('Give desired rate of turn [deg/s], default = 0: ')*pi/180;         if isempty(psidot)            psidot = 0;         end         ok = 1;
      elseif answ == 'r'         R = input('Give desired turn radius (>0) [m], default = straight & level: ');         if isempty(R) ~= 1            psidot = V/R;         else            psidot = 0;         end         ok = 1;
      else         disp('   Invalid entry. Please choose either ''t'', or ''r''');
      end
   end
   rolltype = 'b';   % No rolling, so for reasons of simplicity the default setting, 
                     % i.e. a body-axes roll, will be used.
elseif opt == 3                                              % STEADY PULL-UP                                                             % --------------   clc   disp('Steady pull-up.');   disp('===============');   V = input('Give desired airspeed [m/s], default = 45: ');   if isempty(V)      V = 45;   end   H = input('Give initial altitude [m], default = 0: ');   if isempty(H)      H = 0;   end   psi = input('Give initial heading [deg], default = 0: ')*pi/180;   if isempty(psi)      psi = 0;   end   gammatype = 'f';  % Use specified flightpath angle and numerically                     % adjust manifold pressure   gamma = input('Give initial flightpath angle [deg], default = 0: ')*pi/180;   if isempty(gamma)      gamma = 0;   end   phidot = 0;   psidot = 0;   thetadot = input('Give pull-up rate [deg/s], default = 0: ')*pi/180;   if isempty(thetadot)      thetadot = 0;   end   rolltype = 'b';   % No rolling, so for reasons of simplicity the default setting, 
                     % i.e. a body-axes roll, will be used.
elseif opt == 4                                                 % STEADY ROLL                                                                % -----------   clc   disp('Steady roll.');   disp('============');   V = input('Give desired airspeed [m/s], default = 45: ');   if isempty(V)      V = 45;   end   H = input('Give initial altitude [m], default = 0: ');   if isempty(H)      H = 0;   end   psi = input('Give initial heading [deg], default = 0: ')*pi/180;   if isempty(psi)      psi = 0;   end
   ok = 0;
   while ok~= 1
      gammatype = input('Use specified manifold pressure or flight-path angle ([m]/f)? ','s');
      if isempty(gammatype)
         gammatype = 'm';
      end
      if gammatype == 'f'
         gamma = input('Give flightpath angle [deg], default = 0: ')*pi/180;
         if isempty(gamma)
            gamma = 0;
            ok = 1;
         end
      elseif gammatype == 'm'
         ok = 1;
      else
         disp('   Invalid entry. Please choose either ''m'', or ''f''');
      end
   end
   thetadot = 0;   psidot = 0;   phidot = input('Give desired roll-rate [deg/s], default = 0: ')*pi/180;   if isempty(phidot)      phidot = 0;   end   if phidot ~= 0
      ok = 0;      while ok~= 1         rolltype = input('Roll in body or stability axes reference frame ([b]/s)? ','s');         if isempty(rolltype)
            rolltype = 'b';
         end
         if rolltype == 'b' | rolltype == 's'            ok = 1;         else
            disp('   Invalid entry. Please choose either ''b'', or ''s''');
         end      end   else
      rolltype = 'b';   % No rolling, so for reasons of simplicity the default setting, 
                        % i.e. a body-axes roll, will be used.
   end
else   % Set helpvariable skip = 1, to ensure that the aircraft configuration   % does not have to be entered if the user chooses option 5 = QUIT.   % --------------------------------------------------------------------   skip = 1;end%%%%if skip ~= 1         % DEFINE CONFIGURATION OF THE AIRPLANE, IF NOT QUITTING                     % -----------------------------------------------------   % For the 'Beaver' model, the flap angle and engine speed define the   % configuration of the aircraft (engine speed is selected by the pilot   % and maintained by the regulator of the propeller). Other aircraft   % may have other definitions, like gear in/out, slats, settings of trim   % surfaces, multiple engines, etc., so change the following lines if   % required!   % ---------------------------------------------------------------------   deltaf = input('Give flap angle [deg], default = 0: ')*pi/180;   if isempty(deltaf)      deltaf = 0;   end   n = input('Give engine speed [RPM], default = 1800: ');   if isempty(n)      n = 1800;   end   % For the 'Beaver' aircraft, the engine power is determined by the engine   % speed, which has been set above, and the manifold pressure, which will   % be involved in the trim process if the flightpath angle gamma is user-   % specified, or kept constant if pz is user-specified (defined in string-   % variable gammatype). If the manifold pressure is to be adjusted by the   % numerical trim algorithm, it is important to specify a meaningful esti-   % mation of the manifold pressure, because otherwise the trim process may   % not converge, or may give unrealistic results if the optimization pro-   % cess converges to a LOCAL minimum.   % -----------------------------------------------------------------------   if gammatype == 'f'      pz = input('Give estimate of manifold pressure pz ["Hg], default = 20: ');   else  % gammatype == 'm'      pz = input('Give manifold pressure pz ["Hg], default = 20: ');   end   if isempty(pz)      pz = 20;   end%   % Hdot is the rate-of-climb, which is a function of the flightpath angle%   % (change the program if you want to specify Hdot itself in stead of%   % the flightpath angle gamma).%   % ----------------------------------------------------------------------%   Hdot = V*sin(gamma);   % G is the centripetal acceleration, used for the coordinated turn   % constraint.   % ----------------------------------------------------------------   G = psidot*V/9.80665;   % If steady, uncoordinated, turning condition must be determined, the   % roll angle can be specified freely; equilibrium will be obtained for   % a trimmed-flight sideslip angle, which in this case usually will be   % quite large.   % --------------------------------------------------------------------   phi = [];   if opt == 2 & turntype == 'u';  % Steady turn, uncoordinated.      phi = input('Give desired roll angle phi [deg], default = 0: ')*pi/180;   end   if isempty(phi)      phi = 0;   end
   % All variables which specify the flight condition will be put in the   % vector ctrim (constants for trim process). The variables which are   % varied by the minimization routine FMINS will be put into the vector   % vtrim (variables for trim process). These vectors will have to be   % redefined for aircraft which use other state or input vectors.   %   % The variable phi in ctrim is used for uncoordinated turns only; if a   % coordinated turn is required, the coordinated turn constraint determines   % the values of phi and beta. Type HELP ACCONSTR for more info.   %   % Definition:

⌨️ 快捷键说明

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