Neural network working properly on Matlab but not in Simulink
2 次查看(过去 30 天)
显示 更早的评论
Hello,
I have trained a NARX type neural network using the NNTOOL tool and when I simulate the network for a given input in Matlab using the command
output=sim(net,input)
I get a satisfactory result.
The problem is that when transferring the network to Simulink using the command
gensim(net,ts)
I obtain a model that does not give good results in Simulink, the output signals being very different from what they should be.
What am I doing wrong when transferring the net to a Simulink block so it doesn't work well ?
Thanks in advance.
回答(1 个)
Tarunbir Gambhir
2021-5-25
Please see the documentation page for gensim. When giving a parameter for 'SampleTime', its value may be -1 or any integer greater or equal to 1. However, this may override the default sample time of the trained model and lead to differences in the simulation result.
If you explicitly define the sample time, you should be able to see exactly the same output from MATLAB and Simulink.
2 个评论
另请参阅
类别
在 Help Center 和 File 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!