nA = 6; % number of alpha values
nV = 4; % number of V values
alphaRange = linspace(-20,20,nA)*pi/180;
vRange = linspace(700,1400,nV);
[alphaGrid,vGrid] = ndgrid(alphaRange,vRange);
Since some known state values for trimming depend on the values of and , you must
create a separate operating point specification object for each parameter combination.
for i = 1:nA
for j = 1:nV
% Set parameter values in model.
alpha_ini = alphaGrid(i,j);
v_ini = vGrid(i,j);
% Create default specifications based on the specified parameters.
opspec(i,j) = operspec(sys);
% Specify which states are known and which states are at steady state.
opspec(i,j).States(1).Known = [1;1];
opspec(i,j).States(1).SteadyState = [0;0];
opspec(i,j).States(3).Known = [1;1];
opspec(i,j).States(3).SteadyState = [0;1];
opspec(i,j).States(2).Known = 1;
opspec(i,j).States(2).SteadyState = 0;
opspec(i,j).States(4).Known = 0;
opspec(i,j).States(4).SteadyState = 1;
end
end
Create a parameter structure for batch trimming. Specify a name and value grid for each
parameter.
params(1).Name = 'alpha_ini';
params(1).Value = alphaGrid;
params(2).Name = 'v_ini';
params(2).Value = vGrid;
Trim the model using the specified parameter grid and operating point specifications.
When you specify an array of operating point specifications and varying parameter values,
the dimensions of the specification array must match the parameter grid dimensions.
Batch Compute Steady-State Operating Points for Parameter Variation