# findop

Compute operating condition from specifications

Since R2023b

## Syntax

``op = findop(sys,Name=Value)``
``op = findop(sys,t,Name=Value)``
``op = findop(sys,t,p,Name=Value)``

## Description

example

````op = findop(sys,Name=Value)` computes the operating condition `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.```
````op = findop(sys,t,Name=Value)` computes the operating conditions for `ltvss` models at time `t`.```

example

````op = findop(sys,t,p,Name=Value)` computes the operating conditions for `lpvss` models at time `t` and parameter values `p`.```

## Examples

collapse all

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 ```

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.

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

collapse all

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.

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`.

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

collapse all

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`.

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

collapse all

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`.

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]`.

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

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]`.

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

All Models

collapse all

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

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

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

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

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.

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

## Output Arguments

collapse all

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

• All models (except `mechss`)

FieldDescription
`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` models

FieldDescription
`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.

• For overconstrained problems, `findop` returns the least-squares solution.
• For underdetermined problems, `findop` returns the solution with smallest norm.