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

    %% Initialize Operating Point Search Using MATLAB(R) Code
% This example shows how to initialize operating point values for
% optimization-based operating searches.

%%
% Open the Simulink model.
sys = 'watertank';
load_system(sys)

%%
% Simulate the model for ten time units and extract an operating point
% snapshot.
opsim = findop(sys,10);

%%
% Create an operating point specification object. By default, all model
% states are specified to be at steady state.
opspec = operspec(sys);

%%
% Configure initial values for operating point search.
opspec = initopspec(opspec,opsim);

%%
% Find the steady-state operating point that meets these specifications.
[op,opreport] = findop(sys,opspec);

%%
% The time derivative of each state, |dx|, is effectively zero. This value
% of the state derivative indicates that the operating point is at steady
% state.