Documentation Center 
Steadystate operating point from specifications (trimming) or simulation
[op,opreport]
= findop(sys,opspec)
[op,opreport]
= findop(sys,opspec,options)
op = findop(sys,tsnapshot)
[op,opreport] = findop(sys,opspec) returns the steadystate operating point of the model that meets the specifications opspec. The Simulink^{®} model must be open. If opspec is a vector of operating points specifications, findop returns a vector of corresponding operating points.
[op,opreport] = findop(sys,opspec,options) searches for the operating point of the model using additional optimization algorithm options specified by options.
op = findop(sys,tsnapshot) simulates the model and extracts operating points at the simulation snapshot time instants (snapshots) tsnapshot.
sys 
Simulink model name, specified as a string inside single quotes (' '). 
opspec 
Operating point specification object for the model sys, specified using operspec. opspec can also be a vector of operating point specification objects. If opspec is a vector of operating points specifications, findop returns a vector of corresponding operating points. In this case, findop needs to compile the model only once. Using a vector of operating points allows you to find multiple trimmed operating points without the overhead of compiling the model for each trimming computation. 
options 
Algorithm options, specified using findopOptions. 
tsnapshot 
Simulation snapshot time instants when to extract the operating point of the model, specified as a scalar or vector. 
opreport 
Optimization results report object. This report displays automatically even when you suppress the output using a semicolon. You can avoid displaying the report by using findopOptions to set the DisplayReport field in options to 'off'. The opreport object has these properties:

SteadyState Operating Point (Trimming) From Specifications
This example shows how to use findop to compute an operating point of a model from specifications.
Open Simulink model.
sys = 'watertank';
load_system(sys);
Create operating point specification object.
opspec = operspec(sys)
By default, all model states are specified to be at steady state.
Operating Specification for the Model watertank. (TimeVarying Components Evaluated at time t=0) States:  (1.) watertank/PID Controller/Integrator spec: dx = 0, initial guess: 0 (2.) watertank/WaterTank System/H spec: dx = 0, initial guess: 1 Inputs: None  Outputs: None 
operspec extracts the default operating point of the Simulink model with two states. The model does not have any rootlevel inport blocks and no rootlevel outport blocks or output constraints.
Configure specifications for the first model state.
opspec.States(1).SteadyState = 1; opspec.States(1).x = 2; opspec.States(1).Min = 0;
The first state must be at steady state and have an initial value of 2 with a lower bound of 0.
Configure specifications for the second model state.
opspec.States(2).Known = 1; opspec.States(2).x = 10;
The second state sets the desired height of the water in the tank at 10. Configuring the height as a known value keeps this value fixed when computing the operating point.
Find the operating point that meets these specifications.
[op,opreport] = findop(sys,opspec) bdclose(sys);
opreport describes how closely the optimization algorithm met the specifications at the end of the operating point search.
Operating Report for the Model watertank. (TimeVarying Components Evaluated at time t=0) Operating point specifications were successfully met. States:  (1.) watertank/PID Controller/Integrator x: 1.26 dx: 0 (0) (2.) watertank/WaterTank System/H x: 10 dx: 0 (0) Inputs: None  Outputs: None 
dx indicates the time derivative of each state. The actual dx values of zero indicate that the operating point is at steady state. The desired dx value is in parentheses.
SteadyState Operating Point to Meet Output Specification
This example shows how to specify an output constraint for computing the steadystate operating point of a model.
Open Simulink model.
sys = 'scdspeed';
open_system(sys);
Create operating point specification object.
opspec = operspec(sys);
By default, all model states are specified to be at steady state.
Configure the output specification.
blk = [sys '/rad//s to rpm'];
opspec = addoutputspec(opspec,blk,1);
opspec.Outputs(1).Known = true;
opspec.Outputs(1).y = 2000;
addoutputspec adds to the operating point specification an output specification for the output of the block rad/s to rpm. This output specification, stored in opspec.Outputs(1), allows you to specify a fixed output value for that block as part of the operating point specification. Setting the Known attribute of the output specification to true ensures that the fixed output level is a constraint in the operating point search.
Find the operating point that meets the output specification.
op = findop(sys,opspec); bdclose(sys);
Operating Point Search Report:  Operating Report for the Model scdspeed. (TimeVarying Components Evaluated at time t=0) Operating point specifications were successfully met. States:  (1.) scdspeed/Throttle & Manifold/Intake Manifold/p0 = 0.543 bar x: 0.544 dx: 2.66e13 (0) (2.) scdspeed/Vehicle Dynamics/w = T//J w0 = 209 rad//s x: 209 dx: 8.48e12 (0) Inputs:  (1.) scdspeed/Throttle perturbation u: 0.00382 [Inf Inf] Outputs:  (1.) scdspeed/rad//s to rpm y: 2e+03 (2e+03)
The search report shows that the operating point search was successful. op is an operating point object that specifies a steadystate operating point for the model scdspeed, in which the output of the rad/s to rpm block is 2000.
Operating Points for Multiple Specification Sets
Find operating points for multiple operating point specifications with a single model compilation.
Each time you call findop, the software compiles the Simulink model. To find operating points for multiple specifications, you can give findop a vector of operating point specifications. Then findop only compiles the model once.
Open Simulink model.
sys = 'scdspeed';
open_system(sys);
Create operating point specification object.
opspec1 = operspec(sys);
By default, all model states are specified to be at steady state.
Configure the output specification.
blk = [sys '/rad//s to rpm'];
opspec1 = addoutputspec(opspec1,blk,1);
opspec1.Outputs(1).Known = true;
opspec1.Outputs(1).y = 1500;
opspec1 specifies a steadstate operating point in which the output of the block rad/s to rpm is fixed at 500.
Note: Alternatively, you can configure an operating point specification using the Linear Analysis Tool and export the specification to the MATLAB^{®} workspace. See Import and Export Specifications For Operating Point Search for more information. 
Create and configure additional operating point specifications.
opspec2 = copy(opspec1); opspec2.Outputs(1).y = 2000; opspec3 = copy(opspec1); opspec3.Outputs(1).y = 2500;
Using the copy command creates an independent operating point specification that you can edit without changing opspec1. Here, the specifications opspec2 and opspec3 are identical to opspec1, except for the target output level.
Find the operating points that meet each of the three output specifications.
opspecs = [opspec1,opspec2,opspec3]; ops = findop(sys,opspecs); bdclose(sys);
Pass the three operating point specifications to findop in the vector opspecs. When you give findop a vector of operating point specifications, it finds all the operating points with only one model compilation. ops is a vector of operating point objects for the model scdspeed that correspond to the three specifications in the vector.
Initialize SteadyState Operating Point Search Using Simulation
This example shows how to use findop to compute an operating point of a model from specifications, where the initial state values are extracted from a simulation snapshot.
Open Simulink model.
sys = 'watertank'; load_system(sys);
Extract an operating point from simulation after 10 time units.
opsim = findop(sys,10);
Create 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) bdclose(sys);
opreport describes the optimization algorithm status at the end of the operating point search.
Operating Report for the Model watertank. (TimeVarying Components Evaluated at time t=0) Operating point specifications were successfully met. States:  (1.) watertank/PID Controller/Integrator x: 1.26 dx: 0 (0) (2.) watertank/WaterTank System/H x: 10 dx: 1.1e014 (0) Inputs: None  Outputs: None 
dx, which is the time derivative of each state, is effectively zero. This value of the state derivative indicates that the operating point is at steady state.
SteadyState Operating Points at Simulation Snapshots
This example shows how to use findop to extract operating points of a model from specifications snapshots.
Open Simulink model.
sys = 'magball'; load_system(sys);
Extract an operating point from simulation at 10 and 20 time units.
op = findop(sys,[10,20]);
Display the first operating point.
op(1)
Operating Point for the Model magball. (TimeVarying Components Evaluated at time t=10) States:  (1.) magball/Controller/PID Controller/Filter x: 5.47e007 (2.) magball/Controller/PID Controller/Integrator x: 14 (3.) magball/Magnetic Ball Plant/Current x: 7 (4.) magball/Magnetic Ball Plant/dhdt x: 8.44e008 (5.) magball/Magnetic Ball Plant/height x: 0.05 Inputs: None 
Display the second operating point.
op(2)
Operating Point for the Model magball. (TimeVarying Components Evaluated at time t=20) States:  (1.) magball/Controller/PID Controller/Filter x: 2.07e007 (2.) magball/Controller/PID Controller/Integrator x: 14 (3.) magball/Magnetic Ball Plant/Current x: 7 (4.) magball/Magnetic Ball Plant/dhdt x: 3.19e008 (5.) magball/Magnetic Ball Plant/height x: 0.05 Inputs: None 
View Operating Point Object
This example shows how to use get to display the operating point states, inputs, and outputs.
sys = 'watertank'; load_system(sys); op = operpoint(sys) get(op.States(1))
Synchronize Simulink Model Changes With Operating Point Specification
This example shows how to use update to update an existing operating point specification object after you update the Simulink model.
Open Simulink model.
sys = 'scdspeedctrl'; open_system(sys);
Create operating point specification object.
By default, all model states are specified to be at steady state.
opspec = operspec(sys);
In the Simulink Editor, doubleclick the Reference Filter block. Change the Numerator of the transfer function to [100] and the Denominator to [1 20 100]. Click OK.
Find the steady state operating point that meets these specifications.
op = findop(sys,opspec)
This command results in an error because the changes to your model are not reflected in your operating point specification object:
??? The model scdspeedctrl has been modified and the operating point object is out of date. Update the object by calling the function update on your operating point object.
Update the operating point specification object with changes to the model. Repeat the operating point search.
opspec = update(opspec); op = findop(sys,opspec) bdclose(sys);
After updating the operating point specifications object, the optimization algorithm successfully finds the operating point.
As an alternative to the findop command, find operating points using the Linear Analysis Tool. See the following examples:
addoutputspec  findopOptions  initopspec  linearize  operspec