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

15 vues (au cours des 30 derniers jours)
Yanchen Chen
Yanchen Chen le 10 Avr 2018
Commenté : Abdullah le 14 Mar 2024
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?

Réponse acceptée

Birdman
Birdman le 10 Avr 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 commentaires
Shaik Merkatur Hakim Marjuban
Add a line "sim('x')" before plot. the x=the file name of simulink. try this
Abdullah
Abdullah le 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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur General Applications dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by