Using Simulink | ![]() ![]() |
Sample Time Propagation
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 sets sample times for individual blocks according to these rules:
For blocks whose inputs have different sample times, if all sample times are integer multiples of the fastest sample time, the block is assigned the sample time of the fastest input. If a variable-step solver is being used, the block is assigned the continuous sample time. If a fixed-step solver is being used and the greatest common divisor of the sample times (the fundamental sample time) can be computed, it is used. Otherwise continuous is used.
Under some circumstances, Simulink also backpropagates 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 | Invariant Constants | ![]() |