Why tout is different from the result of time block in Simulink?
16 views (last 30 days)
Show older comments
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?
0 Comments
Accepted Answer
Birdman
on 10 Apr 2018
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 Comments
Shaik Merkatur Hakim Marjuban
on 22 Apr 2020
Add a line "sim('x')" before plot. the x=the file name of simulink. try this
Abdullah
on 14 Mar 2024
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
More Answers (0)
See Also
Categories
Find more on General Applications in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!