NARX export to Simulink time step

4 visualizzazioni (ultimi 30 giorni)
Sohrab Allahyari
Sohrab Allahyari il 26 Feb 2024
Risposto: Tejas il 21 Ago 2024
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

Risposte (1)

Tejas
Tejas il 21 Ago 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 .

Categorie

Scopri di più su Sequence and Numeric Feature Data Workflows in Help Center e File Exchange

Prodotti


Release

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by