# idNeuralStateSpace

## Description

Use `idNeuralStateSpace`

to create a black-box continuous-time or
discrete-time neural state-space model with identifiable (estimable) network weights and bias.
You can use the trained black-box model for control, estimation, optimization, and reduced
order modeling.

Continuous-time neural state space models have the following general form,

$$\begin{array}{l}\dot{x}\left(t\right)=F\left(t,x\left(t\right),u\left(t\right)\right)\\ y\left(t\right)=\left[\begin{array}{c}{y}_{1}(t)\\ {y}_{2}(t)\end{array}\right]=\left[\begin{array}{c}x\left(t\right)+{e}_{1}(t)\\ H\left(t,x\left(t\right),u\left(t\right)\right)+{e}_{2}(t)\end{array}\right]\end{array}$$

where the state function *F* and the nontrivial
output function *H* are approximated by neural networks. Because you
need to measure all the states to properly train the state function, the states
measurements are considered to be part of the output function. Here,
*e _{1}* and

*e*are measurement noises in the data sets which are minimized by the network training algorithm.

_{2}For discrete-time state-space systems, the state and output functions have this form.

$$\begin{array}{l}x\left(t+1\right)=F\left(t,x\left(t\right),u\left(t\right)\right)\\ y\left(t\right)=\left[\begin{array}{c}{y}_{1}(t)\\ {y}_{2}(t)\end{array}\right]=\left[\begin{array}{c}x\left(t\right)+{e}_{1}(t)\\ H\left(t,x\left(t\right),u\left(t\right)\right)+{e}_{2}(t)\end{array}\right]\end{array}$$

**Note**

Defining and estimating a neural state space system requires that:

You know what the states of the systems are (to your best knowledge).

The states are measured, and thus, their measurements are part of experiment data set.

## Creation

### Description

creates an autonomous (no-input) time-invariant continuous-time neural state-space
object with `nss`

= idNeuralStateSpace(`nx`

)`nx`

state variables and output identical to
state.

specifies name-value pair arguments after any of the input argument in the previous
syntax. You can use name-value pair arguments to set the number of inputs and outputs
and other system configurations such as time domain, whether the system is time
invariant and whether the system output has feed-through.`nss`

= idNeuralStateSpace(___,`Name=Value`

)

For example, ```
nss =
idNeuralStateSpace(3,NumInputs=2,NumOutputs=4,Ts=0.1)
```

creates a
time-invariant discrete-time neural state-space object with `3`

states,
`2`

inputs, four outputs (the first three are state measurements),
and sample time `0.1`

. The system is also time invariant (both state
and output functions do not explicitly depend on time) and does not have direct
feed-through (the input does not have immediate impact on output).

### Input Arguments

## Properties

## Object Functions

`createMLPNetwork` | Create and initialize a Multi-Layer Perceptron (MLP) network to be used within a neural state-space system |

`generateMATLABFunction` | Generate MATLAB functions that evaluate the state and output functions of a neural state-space object, and their Jacobians |

`sim` | Simulate response of identified model |

`idNeuralStateSpace/evaluate` | Evaluate a neural state-space system for a given set of state and input values and return state derivative (or next state) and output values |

`idNeuralStateSpace/linearize` | Linearize a neural state-space model around an operating point |

## Examples

## References

[1] Chen, Ricky T. Q., Yulia Rubanova, Jesse Bettencourt, and David Duvenaud. “Neural Ordinary Differential Equations.” arXiv, December 13, 2019. http://arxiv.org/abs/1806.07366.

## Version History

**Introduced in R2022b**

## See Also

### Objects

### Functions

`createMLPNetwork`

|`nssTrainingOptions`

|`nlssest`

|`generateMATLABFunction`

|`idNeuralStateSpace/evaluate`

|`idNeuralStateSpace/linearize`

|`sim`