NARX export to Simulink time step
Show older comments
Hello,
I want to export my trained model to Simulink using MATLAB's "Export to Simulink " option. I have a problem exporting the NARX network with the time constant. My simulation step size is 0.001, but the trained NARX network block overlooks the step size and uses 1 second as the step size visible in the picture.
I didn't experience this when I worked with MLP networks. How can I adjust the step size when exporting the block?
Thank you

Answers (1)
Tejas
on 21 Aug 2024
Hello Sohrab,
When exporting a NARX network block to Simulink, the ‘gensim’ function can be used to adjust the sample time as needed. There are two ways to do this:
- By directly specifying the sample time by providing the network as the first input and the sample time as the second input.
gensim(net, 0.001);
- Using name-value pair to specify the sample time, especially when dealing with multiple inputs, as demonstrated in the example below.
[sysName,netName] = gensim(net,'SampleTime',0.001,'InputMode','Workspace',...
'OutputMode','Workspace','SolverMode','Discrete');
The following documentation can be referred to get more information on ‘gensim’ function: https://www.mathworks.com/help/releases/R2022b/deeplearning/ref/network.gensim.html .
Categories
Find more on Pattern Recognition in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!