Neural network working properly on Matlab but not in Simulink

조회 수: 5 (최근 30일)
Haritz Odriozola Olalde
Haritz Odriozola Olalde 2021년 5월 21일
댓글: Kanchan Jha 2023년 7월 11일
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
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
Haritz Odriozola Olalde
Haritz Odriozola Olalde 2021년 6월 8일
Hi Tarunbir,
I have read the gensim documentation page and it does not appear anywhere that the sampling time must be an integer. In fact, we have tried entering st=0.00025 and it works. Still, we have found where the problem was, so thank you very much for your answer.
Regards
akram
akram 2023년 2월 18일
Hello, I have exactely the same problem, did you find the solution ?

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

카테고리

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