Why tout is different from the result of time block in Simulink?

조회 수: 13 (최근 30일)
Yanchen Chen
Yanchen Chen 2018년 4월 10일
댓글: Abdullah 2024년 3월 14일
In the Simulink model I create, I use a time block to record the time and output it into the workspace. The problem is that the output from the time block is different from the system default tout. The length of the vector directly output from the time block is 421, and the length of tout is 433. Thus, the other output of the system has different length of vector, some as 421 some as 433. Why this happen and how to correct?

채택된 답변

Birdman
Birdman 2018년 4월 10일
Actually, this has something to do with your solver settings. Probably, your solver type is set to variable step and you record time to your workspace with a defined sampling time of its own. tout time array is saved to the workspace with a sample time that solver automatically selects but your time data is saved with a predefined sampling time. The difference occurs from that. Change your solver type to fixed step and define the same sampling time with your saved time data. Then, they should have the same length. Hope this helps.
  댓글 수: 3
Shaik Merkatur Hakim Marjuban
Shaik Merkatur Hakim Marjuban 2020년 4월 22일
Add a line "sim('x')" before plot. the x=the file name of simulink. try this
Abdullah
Abdullah 2024년 3월 14일
Hello Birdman,
when i change the solver to fixed step, there are no resulst can be shown. sample fixed step is lower than the sample rate of the controller

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 General Applications에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by