Fixed step discrete time is not really fixed in Simulink

7 次查看(过去 30 天)
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

采纳的回答

Ryan G
Ryan G 2012-7-16
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 个评论
AV
AV 2012-7-16
Thanks Ryan. The post that you suggested explains exactly my problem and a nice solution.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Event Functions 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by