Contents

Rolling missile simulation

%--------------------------------------------------------------------------
%   Copyright (c) 2018 Princeton Satellite Systems, Inc.
%   All rights reserved.
%--------------------------------------------------------------------------
%   Since 1.0
%--------------------------------------------------------------------------

Initial conditions

d     = RHSRollingMissileLinear;
tEnd  = 17;
dT    = 0.001;
n     = ceil(tEnd/dT);
x     = zeros(5,1);
xP    = zeros(size(x,1)+2,n);

% Step command
d.deltaY = 0.1;

Simulation

for k = 1:n
  xP(:,k) = [x;d.deltaP;d.deltaY];
  x       = RK4(@RHSRollingMissileLinear,x,dT,0,d);
end

[t,tL] = TimeLabl((0:n-1)*dT);

yL     = {'\beta (rad)'  '\alpha (rad)'   'q (rad/s)' 'r (rad/s)'  ...
          '\theta (rad)' '\delta_p (rad)' '\delta_y (rad)'};

Plot2D(t,xP(1:5,:),tL,yL(1:5),'States');
Plot2D(t,xP(6:7,:),tL,yL(6:7),'Control');


%--------------------------------------