| Using Simulink | ![]() |
Sample Time Propagation
When updating a model's diagram, for example, at the beginning of a simulation, Simulink uses a process called sample time propagation to determine the sample times of blocks that inherit their sample times. The figure below illustrates a Discrete Filter block with a sample time of Ts driving a Gain block.
Because the Gain block's output is simply the input multiplied by a constant, its output changes at the same rate as the filter. In other words, the Gain block has an effective sample rate equal to that of the filter's sample rate. This is the fundamental mechanism behind sample time propagation in Simulink.
Simulink assigns an inherited sample time to a block based on the sample times of the blocks connected to its inputs, using the following rules.
| Note A Model block can inherit its sample time from its inputs only if the inputs and outputs of the model that it references do not depend on the sample time (see Model Block Sample Times for more information). |
Under some circumstances, Simulink also back propagates sample times to source blocks if it can do so without affecting the output of a simulation. For instance, in the model below, Simulink recognizes that the Signal Generator block is driving a Discrete-Time Integrator block, so it assigns the Signal Generator block and the Gain block the same sample time as the Discrete-Time Integrator block.
You can verify this by selecting Sample Time Colors from the Simulink Format menu and noting that all blocks are colored red. Because the Discrete-Time Integrator block only looks at its input at its sample times, this change does not affect the outcome of the simulation but does result in a performance improvement.
Replacing the Discrete-Time Integrator block with a continuous Integrator block, as shown below, and recoloring the model by choosing Update diagram from the Edit menu cause the Signal Generator and Gain blocks to change to continuous blocks, as indicated by their being colored black.
| Determining Step Size for Discrete Systems | Constant Sample Time | ![]() |
© 1994-2005 The MathWorks, Inc.