# nlssest

Estimate nonlinear state-space model using measured time-domain system data

Since R2022b

## Syntax

``nssEstimated = nlssest(U,Y,nss)``
``nssEstimated = nlssest(Data,nss)``
``nssEstimated = nlssest(___,Options)``
``nssEstimated = nlssest(___,Name=Value)``

## Description

````nssEstimated = nlssest(U,Y,nss)` uses measured input and output data sets `U` and `Y`, and default training options, to train the state and output networks of the `idNeuralStateSpace` object `nss`. It returns the `idNeuralStateSpace` object `nssEstimated` with trained state and the output networks.```
````nssEstimated = nlssest(Data,nss)` uses measured input and output data stored in `Data`, and the default training options, to train the state and output networks of `nss`.```
````nssEstimated = nlssest(___,Options)` specifies custom training options, which use either the Adam algorithm or SGDM algorithm to train the networks.```

example

````nssEstimated = nlssest(___,Name=Value)` specifies name-value pair arguments after any of the input argument in the previous syntax. Use name-value pair arguments to specify whether you want to use the last experiment for validation, and the frequency for the validation plots.```

## Examples

collapse all

This example shows how to estimate a neural-state space model with one input and one state equal to the output. First, you collect identification and validation data by simulating a linear system, then use the collected data to estimate and validate a neural state-space system, and finally compare the estimated system to the original linear system used to produce the data.

Define Linear Model for Data Collection

Define a linear time-invariant discrete-time model that can be easily simulated to collect data. For this example, use a low-pass filter with a bandwidth of about `1` rad/sec, discretized with a sample time of `0.1` sec.

```Ts = 0.1; sys = ss(c2d(tf(1,[1 1]),Ts));```

The identification of a neural state-space system requires you to have measurement of the system states. Therefore, transform the state-space coordinates so that the output is equal to the state.

```sys.b = sys.b*sys.c; sys.c = 1;```

Generate Data Set for Identification

Fix the random generator seed for reproducibility.

`rng(0);`

Run `1000` simulations each starting at a different initial state and lasting `1` second. Each experiment must use identical time points.

```N = 1000; U = cell(N,1); Y = cell(N,1); for i=1:N % Each experiment uses random initial state and input sequence t = (0:Ts:1)'; u = 0.5*randn(size(t)); x0 = 0.5*randn(1,1); % Obtain state measurements over t x = lsim(sys,u,t,x0); % Each experiment in the data set is a timetable U{i} = array2timetable(u,RowTimes=seconds(t)); Y{i} = array2timetable(x,RowTimes=seconds(t)); end```

Generate Data Set for Validation

Run one simulation to collect data that will be used to visually inspect training result during the identification progress. The validation data set can have different time points. For this example, simulate the trained model for 10 seconds.

```% Use random initial state and input sequence t = (0:Ts:10)'; u = 0.5*randn(size(t)); x0 = 0.5*randn(1,1); % Obtain state measurements over t x = lsim(sys,u,t,x0); % Append the validation experiment (also a timetable) as the last entry in the data set U{end+1} = array2timetable(u,RowTimes=seconds(t)); Y{end+1} = array2timetable(x,RowTimes=seconds(t));```

Create a Neural State-Space Object

Create time-invariant discrete-time neural state-space object with one state identical to the output, one input, and sample time `Ts`.

`nss = idNeuralStateSpace(1,NumInputs=1,Ts=Ts);`

Configure State Network

Define the neural network that approximates the state function as having no hidden layer (because the output layer, which is a fully connected layer, should be sufficient to approximate the linear function: $x\left[k+1\right]=\mathit{Ax}\left[k\right]+\mathit{Bu}\left[k\right]$).

Use `createMLPNetwork` to create the network and dot notation to assign it to the `StateNetwork` property of `nss`.

```nss.StateNetwork = createMLPNetwork(nss,'state', ... LayerSizes=zeros(0,1), ... WeightsInitializer="glorot", ... BiasInitializer="zeros");```

Display the number of network parameters.

`summary(nss.StateNetwork)`
``` Initialized: true Number of learnables: 3 Inputs: 1 'x[k]' 1 features 2 'u[k]' 1 features ```

Specify the training options for the state network. Use the Adam algorithm, specify the maximum number of epochs as 3`00` (an epoch is the full pass of the training algorithm over the entire training set), and let the algorithm use the entire set of 1000 experiment data as a batch set to calculate the gradient at each iteration.

```opt = nssTrainingOptions('adam'); opt.MaxEpochs = 300; opt.MiniBatchSize = N;```

Also specify the `InputInterSample` option to hold the input constant between two sampling interval. Finally, specify the learning rate.

```opt.InputInterSample = "zoh"; opt.LearnRate = 0.01;```

Estimate the Neural State-Space System

Use `nlssest` to train the state network of `nss`, using the identification data set and the predefined set of optimization options.

`nss = nlssest(U,Y,nss,opt,'UseLastExperimentForValidation',true);`
```Training in progress (completed epoch/max epochs): 0/ 300 1/ 300 2/ 300 3/ 300 4/ 300 5/ 300 6/ 300 7/ 300 8/ 300 9/ 300 10/ 300 11/ 300 12/ 300 13/ 300 14/ 300 15/ 300 16/ 300 17/ 300 18/ 300 19/ 300 20/ 300 21/ 300 22/ 300 23/ 300 24/ 300 25/ 300 26/ 300 27/ 300 28/ 300 29/ 300 30/ 300 31/ 300 32/ 300 33/ 300 34/ 300 35/ 300 36/ 300 37/ 300 38/ 300 39/ 300 40/ 300 41/ 300 42/ 300 43/ 300 44/ 300 45/ 300 46/ 300 47/ 300 48/ 300 49/ 300 50/ 300 51/ 300 52/ 300 53/ 300 54/ 300 55/ 300 56/ 300 57/ 300 58/ 300 59/ 300 60/ 300 61/ 300 62/ 300 63/ 300 64/ 300 65/ 300 66/ 300 67/ 300 68/ 300 69/ 300 70/ 300 71/ 300 72/ 300 73/ 300 74/ 300 75/ 300 76/ 300 77/ 300 78/ 300 79/ 300 80/ 300 81/ 300 82/ 300 83/ 300 84/ 300 85/ 300 86/ 300 87/ 300 88/ 300 89/ 300 90/ 300 91/ 300 92/ 300 93/ 300 94/ 300 95/ 300 96/ 300 97/ 300 98/ 300 99/ 300 100/ 300 101/ 300 102/ 300 103/ 300 104/ 300 105/ 300 106/ 300 107/ 300 108/ 300 109/ 300 110/ 300 111/ 300 112/ 300 113/ 300 114/ 300 115/ 300 116/ 300 117/ 300 118/ 300 119/ 300 120/ 300 121/ 300 122/ 300 123/ 300 124/ 300 125/ 300 126/ 300 127/ 300 128/ 300 129/ 300 130/ 300 131/ 300 132/ 300 133/ 300 134/ 300 135/ 300 136/ 300 137/ 300 138/ 300 139/ 300 140/ 300 141/ 300 142/ 300 143/ 300 144/ 300 145/ 300 146/ 300 147/ 300 148/ 300 149/ 300 150/ 300 151/ 300 152/ 300 153/ 300 154/ 300 155/ 300 156/ 300 157/ 300 158/ 300 159/ 300 160/ 300 161/ 300 162/ 300 163/ 300 164/ 300 165/ 300 166/ 300 167/ 300 168/ 300 169/ 300 170/ 300 171/ 300 172/ 300 173/ 300 174/ 300 175/ 300 176/ 300 177/ 300 178/ 300 179/ 300 180/ 300 181/ 300 182/ 300 183/ 300 184/ 300 185/ 300 186/ 300 187/ 300 188/ 300 189/ 300 190/ 300 191/ 300 192/ 300 193/ 300 194/ 300 195/ 300 196/ 300 197/ 300 198/ 300 199/ 300 200/ 300 201/ 300 202/ 300 203/ 300 204/ 300 205/ 300 206/ 300 207/ 300 208/ 300 209/ 300 210/ 300 211/ 300 212/ 300 213/ 300 214/ 300 215/ 300 216/ 300 217/ 300 218/ 300 219/ 300 220/ 300 221/ 300 222/ 300 223/ 300 224/ 300 225/ 300 226/ 300 227/ 300 228/ 300 229/ 300 230/ 300 231/ 300 232/ 300 233/ 300 234/ 300 235/ 300 236/ 300 237/ 300 238/ 300 239/ 300 240/ 300 241/ 300 242/ 300 243/ 300 244/ 300 245/ 300 246/ 300 247/ 300 248/ 300 249/ 300 250/ 300 251/ 300 252/ 300 253/ 300 254/ 300 255/ 300 256/ 300 257/ 300 258/ 300 259/ 300 260/ 300 261/ 300 262/ 300 263/ 300 264/ 300 265/ 300 266/ 300 267/ 300 268/ 300 269/ 300 270/ 300 271/ 300 272/ 300 273/ 300 274/ 300 275/ 300 276/ 300 277/ 300 278/ 300 279/ 300 280/ 300 281/ 300 282/ 300 283/ 300 284/ 300 285/ 300 286/ 300 287/ 300 288/ 300 289/ 300 290/ 300 291/ 300 292/ 300 293/ 300 294/ 300 295/ 300 296/ 300 297/ 300 298/ 300 299/ 300 ```

``` 300/ 300 ```

```Generating estimation report...done. ```

The validation plot shows that the resulting system is able to reproduce well the validation data.

Compare the Estimated System to the Original Linear System

Define a random input and initial condition.

```x0 = 0.3*randn(1,1); u0 = 0.3*randn(1,1);```

Calculate the next state according to the linear system equation.

`sys.a*x0 + sys.b*u0`
```ans = 0.4173 ```

Evaluate `nss` at the point defined by `x0` and `u0`.

`evaluate(nss,x0,u0)`
```ans = 0.4176 ```

The value of the next state calculated by evaluating `nss` is close to the one calculated by evaluating the linear system equation.

Display the linear system.

`sys`
```sys = A = x1 x1 0.9048 B = u1 x1 0.09516 C = x1 y1 1 D = u1 y1 0 Sample time: 0.1 seconds Discrete-time state-space model. ```

Linearize `nss` around zero

`linearize(nss,0,0)`
```ans = A = x1 x1 0.9053 B = u1 x1 0.09488 C = x1 y1 1 D = u1 y1 0 Sample time: 0.1 seconds Discrete-time state-space model. ```

The linearized system matrices are close to the ones of the original system.

Perform an Extra Validation Check

Create input time series and a random initial state.

```t = (0:Ts:10)'; u = 0.5*randn(size(t)); x0 = 0.5*randn(1,1);```

Simulate both the linear and neural state-space system with the same input data, from the same initial state.

```% Simulate original system from x0 ylin = lsim(sys,u,t,x0); % Simulate neural state-space system from x0 simOpt = simOptions('InitialCondition',x0); yn = sim(nss,array2timetable(u,RowTimes=seconds(t)),simOpt);```

Note that you can also use the following code to simulate `nss`.

```x = zeros(size(t)); x(1)=x0; for k = 1:length(t)-1, x(k+1) = evaluate(nss,x(k),u(k)); end ```

Plot the outputs of both systems, also display the norm of the difference in the plot title.

```stairs(t,[ylin yn.Variables]); xlabel("Time"); ylabel("State"); legend("Original","Estimated"); title(['Approximation error = ' num2str(norm(ylin-yn.Variables)) ])```

The two outputs are similar, confirming that the identified system is a good approximation of the original one.

This example shows how to estimate a nonlinear neural-state space model with no inputs and a two-dimensional continuous state equal to the output. First, you collect identification and validation data by simulating a Van Der Pol system, then use the collected data to estimate and validate a neural state-space system, and finally compare the estimated system to the original system used to produce the data.

Define Model for Data Collection

Define a time-invariant continuous-time autonomous model that can be easily simulated to collect data. For this example, use an unforced Van Der Pol system, which is an oscillator with nonlinear damping that exhibits a limit cycle.

Specify the state equation using an anonymous function, using a damping coefficient of `1`.

`dx = @(x) [x(2); 1*(1-x(1)^2)*x(2)-x(1)];`

Generate Data Set for Identification

Fix the random generator seed for reproducibility.

`rng(0);`

Run 1000 simulations each starting at a different initial state and lasting 2 seconds. Each experiment must use identical time points.

```N = 1000; t = (0:0.1:2)'; Y = cell(1,N); for i=1:N % Create random initial state within [-2,2] x0 = 4*rand(2,1)-2; % Obtain state measurements over t (solve using ode45) [~, x] = ode45(@(t,x) dx(x),t,x0); % Each experiment in the data set is a timetable Y{i} = array2timetable(x,RowTimes=seconds(t)); end```

Generate Data Set for Validation

Run one simulation to collect data that will be used to visually inspect training result during the identification progress. The validation data set can have different time points. For this example, use the trained model to predict VDP behavior for 10 seconds.

```% Create random initial state within [-2,2] t = (0:0.1:10)'; x0 = 4*rand(2,1)-2; % Obtain state measurements over t (solve using ode45) [~, x] = ode45(@(t,x) dx(x),t,x0); % Append the validation experiment (also a timetable) as the last entry in the data set Y{end+1} = array2timetable(x,RowTimes=seconds(t));```

Create a Neural State-Space Object

Create time-invariant continuous-time neural state-space object with a two-element state vector identical to the output, and no input.

`nss = idNeuralStateSpace(2);`

Configure State Network

Define the neural network that approximates the state function as having two hidden layers with 8 neurons each, and hyperbolic tangent activation function.

Use `createMLPNetwork` to create the network and dot notation to assign it to the `StateNetwork` property of `nss`.

```nss.StateNetwork = createMLPNetwork(nss,'state', ... LayerSizes=[12 12], ... Activations="tanh", ... WeightsInitializer="glorot", ... BiasInitializer="zeros");```

Display the number of network parameters.

`summary(nss.StateNetwork)`
``` Initialized: true Number of learnables: 218 Inputs: 1 'x' 2 features ```

Specify the training options for the state network. Use the Adam algorithm, specify the maximum number of epochs as `400` (an epoch is the full pass of the training algorithm over the entire training set), and let the algorithm use the entire set of `1000` experiments as a batch set to calculate the gradient at each iteration.

```opt = nssTrainingOptions('adam'); opt.MaxEpochs = 400; opt.MiniBatchSize = N;```

Also specify the leaning rate.

`opt.LearnRate = 0.005;`

Estimate the Neural State-Space System

Use `nlssest` to train the state network of `nss`, using the identification data set and the predefined set of optimization options.

`nss = nlssest([],Y,nss,opt,'UseLastExperimentForValidation',true);`
```Training in progress (completed epoch/max epochs): 0/ 400 1/ 400 2/ 400 3/ 400 4/ 400 5/ 400 6/ 400 7/ 400 8/ 400 9/ 400 10/ 400 11/ 400 12/ 400 13/ 400 14/ 400 15/ 400 16/ 400 17/ 400 18/ 400 19/ 400 20/ 400 21/ 400 22/ 400 23/ 400 24/ 400 25/ 400 26/ 400 27/ 400 28/ 400 29/ 400 30/ 400 31/ 400 32/ 400 33/ 400 34/ 400 35/ 400 36/ 400 37/ 400 38/ 400 39/ 400 40/ 400 41/ 400 42/ 400 43/ 400 44/ 400 45/ 400 46/ 400 47/ 400 48/ 400 49/ 400 50/ 400 51/ 400 52/ 400 53/ 400 54/ 400 55/ 400 56/ 400 57/ 400 58/ 400 59/ 400 60/ 400 61/ 400 62/ 400 63/ 400 64/ 400 65/ 400 66/ 400 67/ 400 68/ 400 69/ 400 70/ 400 71/ 400 72/ 400 73/ 400 74/ 400 75/ 400 76/ 400 77/ 400 78/ 400 79/ 400 80/ 400 81/ 400 82/ 400 83/ 400 84/ 400 85/ 400 86/ 400 87/ 400 88/ 400 89/ 400 90/ 400 91/ 400 92/ 400 93/ 400 94/ 400 95/ 400 96/ 400 97/ 400 98/ 400 99/ 400 100/ 400 101/ 400 102/ 400 103/ 400 104/ 400 105/ 400 106/ 400 107/ 400 108/ 400 109/ 400 110/ 400 111/ 400 112/ 400 113/ 400 114/ 400 115/ 400 116/ 400 117/ 400 118/ 400 119/ 400 120/ 400 121/ 400 122/ 400 123/ 400 124/ 400 125/ 400 126/ 400 127/ 400 128/ 400 129/ 400 130/ 400 131/ 400 132/ 400 133/ 400 134/ 400 135/ 400 136/ 400 137/ 400 138/ 400 139/ 400 140/ 400 141/ 400 142/ 400 143/ 400 144/ 400 145/ 400 146/ 400 147/ 400 148/ 400 149/ 400 150/ 400 151/ 400 152/ 400 153/ 400 154/ 400 155/ 400 156/ 400 157/ 400 158/ 400 159/ 400 160/ 400 161/ 400 162/ 400 163/ 400 164/ 400 165/ 400 166/ 400 167/ 400 168/ 400 169/ 400 170/ 400 171/ 400 172/ 400 173/ 400 174/ 400 175/ 400 176/ 400 177/ 400 178/ 400 179/ 400 180/ 400 181/ 400 182/ 400 183/ 400 184/ 400 185/ 400 186/ 400 187/ 400 188/ 400 189/ 400 190/ 400 191/ 400 192/ 400 193/ 400 194/ 400 195/ 400 196/ 400 197/ 400 198/ 400 199/ 400 200/ 400 201/ 400 202/ 400 203/ 400 204/ 400 205/ 400 206/ 400 207/ 400 208/ 400 209/ 400 210/ 400 211/ 400 212/ 400 213/ 400 214/ 400 215/ 400 216/ 400 217/ 400 218/ 400 219/ 400 220/ 400 221/ 400 222/ 400 223/ 400 224/ 400 225/ 400 226/ 400 227/ 400 228/ 400 229/ 400 230/ 400 231/ 400 232/ 400 233/ 400 234/ 400 235/ 400 236/ 400 237/ 400 238/ 400 239/ 400 240/ 400 241/ 400 242/ 400 243/ 400 244/ 400 245/ 400 246/ 400 247/ 400 248/ 400 249/ 400 250/ 400 251/ 400 252/ 400 253/ 400 254/ 400 255/ 400 256/ 400 257/ 400 258/ 400 259/ 400 260/ 400 261/ 400 262/ 400 263/ 400 264/ 400 265/ 400 266/ 400 267/ 400 268/ 400 269/ 400 270/ 400 271/ 400 272/ 400 273/ 400 274/ 400 275/ 400 276/ 400 277/ 400 278/ 400 279/ 400 280/ 400 281/ 400 282/ 400 283/ 400 284/ 400 285/ 400 286/ 400 287/ 400 288/ 400 289/ 400 290/ 400 291/ 400 292/ 400 293/ 400 294/ 400 295/ 400 296/ 400 297/ 400 298/ 400 299/ 400 300/ 400 301/ 400 302/ 400 303/ 400 304/ 400 305/ 400 306/ 400 307/ 400 308/ 400 309/ 400 310/ 400 311/ 400 312/ 400 313/ 400 314/ 400 315/ 400 316/ 400 317/ 400 318/ 400 319/ 400 320/ 400 321/ 400 322/ 400 323/ 400 324/ 400 325/ 400 326/ 400 327/ 400 328/ 400 329/ 400 330/ 400 331/ 400 332/ 400 333/ 400 334/ 400 335/ 400 336/ 400 337/ 400 338/ 400 339/ 400 340/ 400 341/ 400 342/ 400 343/ 400 344/ 400 345/ 400 346/ 400 347/ 400 348/ 400 349/ 400 350/ 400 351/ 400 352/ 400 353/ 400 354/ 400 355/ 400 356/ 400 357/ 400 358/ 400 359/ 400 360/ 400 361/ 400 362/ 400 363/ 400 364/ 400 365/ 400 366/ 400 367/ 400 368/ 400 369/ 400 370/ 400 371/ 400 372/ 400 373/ 400 374/ 400 375/ 400 376/ 400 377/ 400 378/ 400 379/ 400 380/ 400 381/ 400 382/ 400 383/ 400 384/ 400 385/ 400 386/ 400 387/ 400 388/ 400 389/ 400 390/ 400 391/ 400 392/ 400 393/ 400 394/ 400 395/ 400 396/ 400 397/ 400 398/ 400 399/ 400 ```

``` 400/ 400 ```

```Generating estimation report...done. ```

The validation plot shows that the resulting system is able to reproduce well the validation data.

Compare the Estimated System to the Original Linear System

Define a random initial condition.

`x0 = 0.3*randn(2,1);`

Calculate the state derivative according to the original system equation.

`dx(x0)`
```ans = 2×1 0.3111 0.3243 ```

Evaluate `nss` at `x0`.

`evaluate(nss,x0)`
```ans = 2×1 0.3161 0.3017 ```

The value of the state derivative calculated by evaluating `nss` is close to the one calculated by evaluating the original system equation.

You can linearize `nss` around an operating point, and apply linear control analysis and synthesis methods on the resulting linear time-invariant state-space system.

`sys = linearize(nss,x0)`
```sys = A = x1 x2 x1 0.03365 1.121 x2 -0.9697 1.05 B = Empty matrix: 2-by-0 C = x1 x2 y1 1 0 y2 0 1 D = Empty matrix: 2-by-0 Continuous-time state-space model. ```

Simulate the neural state-space system

Create a time sequence and a random initial state.

```t = (0:0.1:10)'; x0 = 0.3*randn(2,1);```

Simulate both the original and neural state-space system with the same input data, from the same initial state.

```% Simulate original system from x0 [~, x] = ode45(@(t,x) dx(x),t,x0); % Simulate neural state-space system from x0 simOpt = simOptions('InitialCondition',x0,'OutputTimes',t); xn = sim(nss,zeros(length(t),0),simOpt);```

Plot the outputs of both systems, also display the norm of the difference in the plot title.

```figure; subplot(2,1,1) plot(t,x(:,1),t,xn(:,1)); ylabel("States(1)"); legend("Original","Estimated"); title(['Approximation error = ' num2str(norm(x-xn)) ]) subplot(2,1,2) plot(t,x(:,2),t,xn(:,2)); xlabel("Time"); ylabel("States(2)"); legend("Original","Estimated");```

The two outputs are similar, confirming that the identified system is a good approximation of the original one.

## Input Arguments

collapse all

Input data. Specify `U` as:

• A timetable containing a variable for each input. The variable names of the timetable must match the input names of `nss`, and its row times must be `duration` objects. This timetable represents a single experiment. For more information, see `timetable` and `duration`.

• A double matrix with one column for each input signal and one row for each time step. Use this option only if the system is discrete-time (that is `nss.Ts` is greater than zero). This matrix represents a single experiment.

• A cell array of N experiments composed of timetables or double matrices. All the experiments must contain the same time points. In other words the time vector corresponding to all the observations must match.

• An empty array, `[]`, if `nss` has no inputs (that is `size(nss,2)` is zero).

Output data. Specify `Y` as:

• A timetable containing a variable for each output. The variable names of the timetable must match the output names of `nss`, and its row times must be `duration` objects. This timetable represents a single experiment. For more information, see `timetable` and `duration`.

• A double matrix with one column for each output signal and one row for each time step. Use this option only if the system is discrete-time (that is `nss.Ts` is greater than zero). This matrix represents a single experiment.

• A cell array of N experiments composed of timetables or double matrices. All the experiments must contain the same time points. In other words the time vector corresponding to all the observations must match.

Note

The first nx channels in `Y` must be state measurements (here, nx is the number of states specified in `nss`).

Input and output data, specified as a `timetable` or `iddata` object. This argument allows you to specify the training data using a single input argument rather than separate `U` and `Y` arguments. Specify `Data` as one of the following:

• An `iddata` object. If you have multiple experiments, create a multi-experiment `iddata` object. Use this option if all the input and output variables in an experiment share the time vector. For more information, see `merge (iddata)`.

• A timetable. The timetable must contain a variable for each of the input and output variables in `nss`. In the multi-experiment case, use a cell array of timetables. All the timetables in the cell array must use the same time vector.

Neural state-space system, specified as an `idNeuralStateSpace` object.

Training options, specified as an `nssTrainingADAM` or `nssTrainingSGDM` object. Create the training options set object options using the `nssTrainingOptions` command. If `nss` contains a non-state output network (that is, if `nss.OutputNetwork` contains two networks), you can pick different training options for the state transition function network, `nss.StateNetwork`, and the nontrivial output function `nss.OutputNetwork(2)`. Note that `nss.OutputNetwork(1)` does not contain any learnable parameters because is always fixed to the identity function returning all the states as outputs.

Example: `myNrlSS`

### 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: `UseLastExperimentForValidation = true`

Option to use the last experiment for validation, specified as one of the following:

• `true` — The last experiment is not used for training, but only to display a validation plot after a number of epochs specified by `ValidationFrequency`. This allows you to monitor the estimation performance during the training process. The last experiment can have a different duration than all the other experiments

• `false` — All experiments are used for training, and no validation plot is displayed.

Example: `false`

Validation frequency, specified as a positive integer. This is the number of epochs after which the validation plot is updated with a new comparison (new predicted output against measured outputs).

Example: `ValidationFrequency=20`

## Output Arguments

collapse all

Estimated neural state-space system, returned as an `idNeuralStateSpace` object.

## Version History

Introduced in R2022b