NARX export to Simulink time step

3 次查看(过去 30 天)
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

回答(1 个)

Tejas
Tejas 2024-8-21
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 .

类别

Help CenterFile Exchange 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by