Azzera filtri
Azzera filtri

Fixed step discrete time is not really fixed in Simulink

7 visualizzazioni (ultimi 30 giorni)
Dear all,
I am experiencing some problems using a Simulink model with a fixed step discrete time solver (for example 0.01 seconds). The model simply consists of 2 blocks: one "From Workspace" block ("interpolate data" option not enabled), and one "To Workspace" block ("Save format" option set to "Structure with time"). If I run the simulation and I look to the time field of the data saved to workspace, I can see that the time step is not always fixed. It is sometimes lower or greater than 0.01 (sometimes 0.0099999999999, other times 0.010000000001). If I don't want to use the "interpolate data" option, this means that I get an output that it is different from input (i.e. I get some input samples repeated on output, and others that are skipped). The "funny" thing is that this behavior depends on the number of samples of the input variable.
Why am I getting this jitter on the time step? Shouldn't it be supposed to be fixed? Is there any option to force it to exactly what I set on the solver options tab?
Thank you for any help.
Kind regards,
Alberto

Risposta accettata

Ryan G
Ryan G il 16 Lug 2012
The Simulink blog has a post that describes this behavior in pretty good detail here.
Essentially the way the time vector is created in Simulink for the discrete solver may be different from the way your input data has created input time and there is a small error between the two.
  1 Commento
AV
AV il 16 Lug 2012
Thanks Ryan. The post that you suggested explains exactly my problem and a nice solution.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Event Functions in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by