- Specify the airframe position (Xe,Ye,Ze) as (0,0,-Altitude).
for ct=1:40
% Set (phi,theta,psi) to (0,alpha,beta)
opspec(ct).States(1).x = [0 ; alpha(ct)d2r ; beta(ct)d2r];
opspec(ct).States(1).Known = true(3,1);
% Set p=0 (no rolling)
opspec(ct).States(2).x(1) = 0;
opspec(ct).States(2).Known(1) = true;
% Set (Xe,Ye,Ze) to (0,0,-Altitude)
opspec(ct).States(4).x = [0 ; 0 ; -Altitude];
opspec(ct).States(4).Known = true(3,1);
end
Now use findop to compute the trim conditions for all 40 (alpha,beta) combinations in
one go. This batch mode approach involves a single compilation of the model. FINDOP
uses optimization to solve the nonlinear equations characterizing each equilibrium. Here
we use the "SQP" algorithm for this task.
% Set options for FINDOP solver
TrimOptions = findopOptions;
TrimOptions.OptimizationOptions.Algorithm = 'sqp';
TrimOptions.DisplayReport = 'off';
% Trim model
[ops,rps] = findop('csthl20_trim',opspec,TrimOptions);
This returns 8-by-5 arrays OPS (operating conditions) and RPS (optimization reports). You
can use RPS to verify that each trim condition was successfully calculated. Results for the
first (alpha,beta) pair are shown below.
[alpha(1) beta(1)]
ans =
-10 -10
ops(1)
Operating point for the Model csthl20_trim.
(Time-Varying Components Evaluated at time t=0)
Trimming and Linearization of the HL-20 Airframe