How to use an NARX Neural Network in Simulink ?

8 vues (au cours des 30 derniers jours)
karim
karim le 21 Déc 2015
Réponse apportée : Ayush Aniket le 1 Sep 2025 à 5:42
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 commentaires
aimane douch
aimane douch le 16 Mai 2020
Same issue here
世忠
世忠 le 15 Mar 2023
The same

Connectez-vous pour commenter.

Réponses (1)

Ayush Aniket
Ayush Aniket le 1 Sep 2025 à 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.

Catégories

En savoir plus sur Deep Learning Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by