How to use an NARX Neural Network in Simulink ?

조회 수: 8 (최근 30일)
karim
karim 2015년 12월 21일
답변: Ayush Aniket 2025년 9월 1일 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
aimane douch
aimane douch 2020년 5월 16일
Same issue here
世忠
世忠 2023년 3월 15일
The same

댓글을 달려면 로그인하십시오.

답변 (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