How to use an NARX Neural Network in Simulink ?

3 次查看(过去 30 天)
Hello everybody,
to solve a problem using neural network, I follow the following steps:
1) the command "nnstart" in the workspace. 2) I choose "Time Series Tool". 3) I choose "Nonlinear Autoregressive with External Input (NARX)". 4) I choose : Inputs and Targets. 5) Architecture Choices 6) Train.
I got very good results.
to use the neural network in my Simulink program :
1) I clicked on "Save Results". 2) "Simulink Diagram".
I got the Simulink block with two inputs (x1, x2) and an output (y1).
but I do not know how to use it in my Simulink program, for example : 1) how to connect it (x1 with x2 or x2 with y1 ...)? 2) after double clicking on the block there is a window that opens "Function Block Parameters: NARX Neural Network", how to choose the parameters of this window ?
thank very much in advance for your assistance
  5 个评论

请先登录,再进行评论。

回答(1 个)

Ayush Aniket
Ayush Aniket 2025-9-1,5:42
When you export your trained NARX network to Simulink, you get a block with:
  • Two inputs - x1: External input (e.g., control signal or stimulus) and x2: Feedback input (past output values)
  • One output - y1: Predicted output of the system
You can connect the block in Simulink by following the below steps:
  1. Connect x1 to the external input signal (e.g., a control input or stimulus).
  2. Connect x2 to a delayed version of the output y1. This creates the feedback loop needed for autoregression. Use a "Delay block" or "Memory block" to avoid algebraic loops.You may need multiple delays depending on the number of feedback delays used during training.
  3. Output y1 can be used as the system’s predicted output and fed into other parts of your model.
When you double-click the block, you’ll see the Function Block Parameters window. Key settings include:
  • Input Processing Function:Usually mapminmax if you normalized your data during training.If you used custom preprocessing, replicate it here.
  • Output Processing Function: Again, typically mapminmax or removeconstantrows.
  • Sample Time: Set this according to your simulation step size.
  • Initial Conditions:If your network uses delays, you may need to initialize the feedback inputs appropriately.
You can find a detailed walkthrough on how to use NARX networks in Simulink in this MathWorks guide.

类别

Help CenterFile Exchange 中查找有关 Deep Learning Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by