www.gusucode.com > slcontrol 案例源码程序 matlab代码 > slcontrol/VaryParametersAndExtractOPsAtSnapshotsExample.m

    %% Vary Parameters and Extract Operating Points at Simulaton Snapshots
%%
% Open Simulink model.
sys = 'watertank';
open_system(sys)

%%
% Specify parameter values. The parameter grids are 5-by-4 arrays.
[A_grid,b_grid] = ndgrid(linspace(0.9*A,1.1*A,5),...
                         linspace(0.9*b,1.1*b,4));
params(1).Name = 'A';
params(1).Value = A_grid;
params(2).Name = 'b';
params(2).Value = b_grid;

%%
% Simulate the model and extract operating points at |0|, |5|, and |10|
% time units.
op = findop(sys,[0 5 10],params);

%%
% |findop| simulates the model for each parameter value combination, and
% extracts operating points at the specified simulation times.

%%
% |op| is a 3-by-5-by-4 array of operating point objects.
size(op)