Neural StateSpace Model
Libraries:
System Identification Toolbox /
Models
Description
Simulates neural statespace (idNeuralStateSpace
) models.
Ports
Input
u — Input of the neural statespace model
scalar  vector
Input of the neural statespace model, specified as a vector signal with as many
elements as the number of inputs you specify when creating the corresponding
idNeuralStateSpace
object. If the
idNeuralStateSpace
object specified in the block dialog does not
have inputs, this port does not appear.
x0 — Initial state of the neural statespace model
scalar  vector
Initial state of the neural statespace model, specified as a vector signal with
as many elements as the number of states you specify when creating the corresponding
idNeuralStateSpace
object.
Dependencies
To enable this input port, select the initial state source
parameter as External
. Then, connect the port to an
upstream signal supplying the value of the initial state.
Output
y — Output of the neural statespace model
scalar  vector
Output of the neural statespace model, returned as a vector signal with as many
elements as the number of outputs you specify when creating the corresponding
idNeuralStateSpace
object.
x — State of the neural statespace model
scalar  vector
State of the neural statespace model, output as a vector signal with as many
elements as the number of states n_{x} that you
specify when creating the corresponding idNeuralStateSpace
object.
These values are identical to the first n_{x}
values in the y
output.
Dependencies
To enable this output port, select the Output state parameter.
dx — State derivative/difference of the neural statespace model
scalar  vector
State derivative or state difference of the neural statespace model, output as a
vector signal with as many elements as the number of states you specify when creating
the corresponding idNeuralStateSpace
object.
For continuoustime neural state space models, this value is the derivative of the state with respect to time. For discretetime neural state space models, this value is the difference between the next state and the current one.
Dependencies
To enable this output port, select the Output state derivative/difference parameter.
z — Latent state of the neural statespace model
scalar  vector
Internal (latent) state of the neural statespace model, output as a vector signal
with as many elements as the value of the LatentDim
property that you specify when creating the corresponding
idNeuralStateSpace
object.
Dependencies
To enable this output port, specify the value of the
LatentDim
property of the idNeuralStateSpace
object as a finite positive scalar and select the Output state
parameter.
dz — Latent state derivative/difference of the neural statespace model
scalar  vector
Internal (latent) state derivative or latent state difference of the neural
statespace model, output as a vector signal with as many elements as the value of the
LatentDim
property that you specify when creating the corresponding
idNeuralStateSpace
object.
For continuoustime neural state space models, this value is the derivative of the latent state with respect to time. For discretetime neural state space models, this value is the difference between the next latent state and the current one.
Dependencies
To enable this output port, specify the value of the
LatentDim
property of the idNeuralStateSpace
object as a finite positive scalar and select the Output state
derivative/difference parameter.
Parameters
Model — Neural state space object
idNeuralStateSpace(1,'NumInputs',1,'NumOutputs',2)
(default)  idNeuralStateSpace
object
Specify an idNeuralStateSpace
object that defines a neural statespace system by
entering the name of an idNeuralStateSpace
object from the
MATLAB^{®} workspace.
Note
If you change the input/output configuration of Model
in the
workspace, click the ... button next to the
Model edit field in the block dialog to refresh the
Neural StateSpace Model block.
Programmatic Use
Block Parameter:
sys 
Type: string, character vector 
Default:
"idNeuralStateSpace(1,'NumInputs',1,'NumOutputs',2)" 
Initial state source — Initial state source
internal
(default)  external
Specify whether to enter the initial condition directly on the dialog box or to receive the initial condition from an input port.
If you set Initial state source to
internal
, enter the initial condition in the edit field under Initial state.If you set Initial state source to
external
, the input portx0
is added to the block. You must then connect an upstream signal supplying the value of the initial state to thex0
input port.
Programmatic Use
Block Parameter:
x0type 
Type: character vector 
Values: 'internal' 
'external'

Default:
'internal' 
Initial state — Initial state
0
(default)  scalar  vector
Specify the initial state of the neural statespace object as a vector of
n_{x} entries, where
n_{x} is the number of states in
Model
.
Use this parameter make sure that the system states reflect the true plant environment at the start of your simulation, to the best of your knowledge.
Programmatic Use
Block Parameter:
ic 
Type: string, character vector 
Default:
"0" 
Output state — Add external output state port
off
(default)  on
Select this parameter to add the x output port to the block.
During simulation this port outputs the internal state of the idNeuralStateSpace
object specified in Model
.
Programmatic Use
Block Parameter:
returnx 
Type: string, character vector 
Values:
"off" , "on" 
Default:
"off" 
Output state derivative/difference — Add external output state derivative port
off
(default)  on
Select this parameter to add the dx output port to the block.
During simulation this port outputs the time derivative of the internal state of the
idNeuralStateSpace
object specified in Model.
Programmatic Use
Block Parameter:
returndx 
Type: string, character vector 
Values:
"off" , "on" 
Default:
"off" 
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced in R2022bR2024b: Code generation does not create temporary .m
files
Starting in 2024b, temporary .m
files will no longer be created in
the current folder when updating the Neural StateSpace Model Block for
prediction and code generation.
However, if the structure of the dlnetwork
object assigned to the state
or output networks of the neural statespace object is not a multilayer perceptron (MLP)
network, then the implementation of the Neural StateSpace Model Block uses
the Predict (Deep Learning Toolbox) Block and
.mat
files will still be generated in the current folder. In all other
cases, .mat
files will also not be created.
See Also
Objects
Functions
nlssest
createMLPNetwork
setNetwork
nssTrainingOptions
generateMATLABFunction
sim
idNeuralStateSpace/evaluate
idNeuralStateSpace/linearize
Live Editor Tasks
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)