# findop

## Description

computes the operating condition `op`

= findop(`sys`

,`Name=Value`

)`op`

for the state-space model
`sys`

. Use the name-value arguments to specify known target values
for the state `x`

, input `u`

, output
`y`

, and state derivative `dx`

. Set unknown or
free entries of `x`

, `u`

, `y`

,
and `dx`

to `NaN`

.

For `mechss`

models, use `q`

,
`dq`

, and `d2q`

instead of `x`

and `dx`

to constrain degrees of freedom (DOFs) and their first and
second derivatives.

computes the operating conditions for `op`

= findop(`sys`

,`t`

,`Name=Value`

)`ltvss`

models at time
`t`

.

## Examples

### Find Operating Point for MIMO State-Space Model

This example shows how to compute operating condition at various specifications for a state-space model.

Create a state-space model using these multi-input multi-output state matrices.

$$A=\left[\begin{array}{cc}-7& 0\\ 0& -10\end{array}\right]\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}B=\left[\begin{array}{cc}5& 0\\ 0& 2\end{array}\right]\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}C=\left[\begin{array}{cc}1& -4\\ -4& 0.5\end{array}\right]\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}D=\left[\begin{array}{cc}0& -2\\ 2& 0\end{array}\right]$$

Specify the state-space matrices and create the MIMO state-space model.

A = [-7,0;0,-10]; B = [5,0;0,2]; C = [1,-4;-4,0.5]; D = [0,-2;2,0]; sys = ss(A,B,C,D);

Compute steady-state condition with fixed output `y`

= `[–1;1]`

.

op1 = findop(sys,y=[-1;1])

`op1 = `*struct with fields:*
x: [2x1 double]
u: [2x1 double]
w: [0x1 double]
dx: [2x1 double]
y: [2x1 double]
rx: [2x1 double]
ry: [2x1 double]
Equations: 4
Unknowns: 4
Status: 'Well-posed problem. Successfully computed the unique solution.'

Compute steady-state condition for constant input `u`

= `[1;2]`

.

op2 = findop(sys,u=[1;2])

`op2 = `*struct with fields:*
x: [2x1 double]
u: [2x1 double]
w: [0x1 double]
dx: [2x1 double]
y: [2x1 double]
rx: [2x1 double]
ry: [2x1 double]
Equations: 4
Unknowns: 4
Status: 'Well-posed problem. Successfully computed the unique solution.'

Compute steady-state condition with `x(1)`

= 0 and `x(2)`

unspecified.

op3 = findop(sys,x=[0;NaN])

`op3 = `*struct with fields:*
x: [2x1 double]
u: [2x1 double]
w: [0x1 double]
dx: [2x1 double]
y: [2x1 double]
rx: [2x1 double]
ry: [2x1 double]
Equations: 4
Unknowns: 5
Status: 'Underdetermined problem. Returned solution with minimum norm.'

Compute unsteady initial condition with `dx`

= `[1;0]`

and y = `[-1;1]`

.

op4 = findop(sys,y=[-1;1],dx=[1;0])

`op4 = `*struct with fields:*
x: [2x1 double]
u: [2x1 double]
w: [0x1 double]
dx: [2x1 double]
y: [2x1 double]
rx: [2x1 double]
ry: [2x1 double]
Equations: 4
Unknowns: 4
Status: 'Well-posed problem. Successfully computed the unique solution.'

Use dot notation to access the values in these structures. For example, `op4.u`

gives the input values for which the system achieved the unsteady initial condition in the previous specification.

op4.u

`ans = `*2×1*
-0.4785
0.1840

### Find Operating Condition for Sparse Second-Order Model

For this example, consider the sparse matrices for the 3-D beam model subjected to an impulsive point load at its tip.

Extract the sparse matrices from `sparseBeam.mat`

.

load('sparseBeam.mat','M','K','B','F','G','D');

Create the `mechss`

model object by specifying `[]`

for matrix `C`

, since there is no damping.

sys = mechss(M,[],K,B,F,G,D)

Sparse continuous-time second-order model with 3 outputs, 1 inputs, and 3408 degrees of freedom. Use "spy" and "showStateInfo" to inspect model structure. Type "help mechssOptions" for available solver options for this model.

Compute the operating point at the fixed input `u`

= `2`

.

op = findop(sys,u=2)

`op = `*struct with fields:*
q: [3408x1 double]
u: 2
w: [0x1 double]
dq: [3408x1 double]
d2q: [3408x1 double]
y: [3x1 double]
rq: [3408x1 double]
ry: [3x1 double]
Equations: 3411
Unknowns: 3411
Status: 'Well-posed problem. Successfully computed the unique solution.'

The function returns a steady-state condition at this input value. For this problem, the solution is unique.

The problem becomes overconstrained if you specify additional specifications.

q = NaN(3408,1); q(1:100) = randn(100,1); op1 = findop(sys,q=q,u=2,y=[NaN,1,NaN])

`op1 = `*struct with fields:*
q: [3408x1 double]
u: 2
w: [0x1 double]
dq: [3408x1 double]
d2q: [3408x1 double]
y: [3x1 double]
rq: [3408x1 double]
ry: [3x1 double]
Equations: 3411
Unknowns: 3310
Status: 'Overconstrained problem, residuals may exist. Returned least-squares solution.'

In this case, the function returns the least-squares solution.

### Compute Operating Point for Discrete-Time LPV Model

Create a discrete-time linear-parameter varying model.

The matrices and offsets are given by:

$\mathit{A}=\mathrm{sin}\left(0.1\mathit{p}\right)$, $\mathit{B}=1$, $\mathit{C}=1$, $\mathit{D}=0$

$${\mathit{y}}_{0}=0.1\mathrm{sin}\left(\mathit{k}\right)$$.

These matrices and offsets are defined in the `lpvFcnDiscrete.m`

data function provided with this example.

Specify the properties and create the LPV model.

```
Ts = 0.01;
ParamNames = 'p';
DataFcn = @lpvFcnDiscrete;
lpvSys = lpvss(ParamNames,DataFcn,Ts)
```

Discrete-time state-space LPV model with 1 outputs, 1 inputs, 1 states, and 1 parameters.

View the data function.

`type lpvFcnDiscrete.m`

function [A,B,C,D,E,dx0,x0,u0,y0,Delays] = lpvFcnDiscrete(k,p) A = sin(0.1*p); B = 1; C = 1; D = 0; E = []; dx0 = []; x0 = []; u0 = []; y0 = 0.1*sin(k); Delays = [];

Compute the operating condition for the LPV model at `t`

= 0.05 and `p`

= 10. For discrete-time models, specify time as the integer sample index.

op = findop(lpvSys,5,10,x=0.5)

`op = `*struct with fields:*
x: 0.5000
u: 0.0793
w: [0x1 double]
dx: 0
y: 0.4041
rx: 0
ry: 0
Equations: 2
Unknowns: 2
Status: 'Well-posed problem. Successfully computed the unique solution.'

## Input Arguments

`sys`

— Dynamic system

state-space model

Dynamic system, specified as a SISO or MIMO state-space model. Dynamic systems that you can use include:

Continuous-time or discrete-time numeric state-space models, such as

`ss`

models.Generalized or uncertain LTI models such as

`genss`

or`uss`

models. (Using uncertain models requires Robust Control Toolbox™ software.)Sparse state-space models such as

`sparss`

and`mechss`

models.Identified LTI models, such as

`idss`

, or`idgrey`

models. (Using identified models requires System Identification Toolbox™ software.)Linear time-varying (

`ltvss`

) and linear parameter-varying (`lpvss`

) models.

`findop`

does not support non state-space models such as
`tf`

, `zpk`

, `pid`

, and
`frd`

models.

`t`

— Time value

scalar

Time value for evaluating operating point condition for linear time-varying and linear-parameter varying models, specified as a scalar.

For discrete-time systems, `t`

is the integer sample index
`k`

.

`p`

— Parameter values for LPV models

vector

Parameter values for evaluating operating point condition for linear parameter-varying models, specified as a vector of length equal to the number of parameters in the model.

### Name-Value Arguments

Specify optional pairs of arguments as
`Name1=Value1,...,NameN=ValueN`

, where `Name`

is
the argument name and `Value`

is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.

**Example: **`op = findop(sys, y=[1;NaN], u=[NaN;0])`

computes a
steady-state operating condition with `u(2)=0 `

and
`y(1)=1`

.

**First-Order Models Only**

`dx`

— State derivative values

`0`

(default) | vector

State derivative values for computing the operating point, specified as a vector
of length equal to the number of states in `sys`

.

In discrete time, `dx`

specifies the state incremental change
`x[k+1]`

− `x[k]`

.

The algorithm uses the specified numeric values as fixed values. To set entries as
unspecified or free, use `NaN`

.

`x`

— State values

`NaN`

(default) | vector

State values for computing the operating point, specified as a vector of length
equal to the number of states in `sys`

.

The algorithm uses the specified numeric values as fixed values. To set entries as
unspecified or free, use `NaN`

.

`mechss`

Models Only`q`

— Displacement values

`NaN`

(default) | vector

Displacement values for computing the operating point, specified as a vector of
length equal to the number of degrees of freedom in the `mechss`

model `sys`

.

The algorithm uses the specified numeric values as fixed values. To set entries as
unspecified or free, use `NaN`

.

`dq`

— Displacement first derivative values

`0`

(default) | vector

Displacement first derivative values for computing the operating point, specified
as a vector of length equal to the number of degrees of freedom in the
`mechss`

model `sys`

.

In discrete time, `dq`

specifies the incremental change
`q[k+1]`

− `q[k]`

.

`NaN`

.

`d2q`

— Displacement second derivative values

`0`

(default) | vector

Displacement second derivative values for computing the operating point, specified
as a vector of length equal to the number of degrees of freedom in the
`mechss`

model `sys`

.

In discrete time, `d2q`

specifies the incremental change
`q[k+2]`

+ `q[k]`

–
`2q[k+1]`

.

`NaN`

.

**All Models**

`u`

— Input values

`NaN`

(default) | vector

Input values for computing the operating point, specified as a vector of length
equal to the number of inputs in `sys`

.

`NaN`

.

`y`

— Output values

`NaN`

(default) | vector

Output values for computing the operating point, specified as a vector of length
equal to the number of outputs in `sys`

.

`NaN`

.

`w`

— Internal signal values

`NaN`

(default) | vector

Internal signal specification, specified as a vector of length equal to the number of internal delays in the model. Use this input only when the model has internal delays.

`NaN`

.

## Output Arguments

`op`

— Operating point

structure

Computed operating condition, returned as a structure with these fields.

All models (except

`mechss`

)Field Description `x`

Computed value for state vector, returned as a column vector of length equal to the number of states. `u`

Computed value for input vector, returned as a column vector of length equal to the number of inputs. `w`

Computed value for internal delay signals (if any), returned as a column vector of length equal to the number of internal delays in the model. `dx`

Computed value for state derivative vector, returned as a column vector of length equal to the number of states. `y`

Computed value for output vector, returned as a column vector of length equal to the number of outputs. `rx`

Residuals for state equations, returned as a column vector of length equal to the number of states. `ry`

Residuals for output equations, returned as a column vector of length equal to the number of outputs. `Equations`

Number of equations to solve to compute operating conditions. `Unknowns`

Number of unknowns in the equations. `Status`

Status report. `mechss`

modelsField Description `q`

Computed value for displacement vector, returned as a column vector of length equal to the number of degrees of freedom. `u`

Computed value for input vector, returned as a column vector of length equal to the number of inputs. `w`

Computed value for internal delay signals (if any), returned as a column vector of length equal to the number of internal delays in the model. `dq`

Computed value for first derivative of displacement vector, returned as a column vector of length equal to the number of degrees of freedom. `d2q`

Computed value for second derivative of displacement vector, returned as a column vector of length equal to the number of degrees of freedom. `y`

Computed value for output vector, returned as a column vector of length equal to the number of outputs. `rq`

Residuals for displacement equations, returned as a column vector of length equal to the number of degrees of freedom. `ry`

Residuals for output equations, returned as a column vector of length equal to the number of outputs. `Equations`

Number of equations to solve to compute operating conditions. `Unknowns`

Number of unknowns in the equations. `Status`

Status report.

Additionally,

For overconstrained problems,

`findop`

returns the least-squares solution.For underdetermined problems,

`findop`

returns the solution with smallest norm.

## Version History

**Introduced in R2023b**

## Open Example

You have a modified version of this example. Do you want to open this example with your edits?

## MATLAB Command

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)