What Is Sample Time?
The sample time of a block is a parameter
that indicates when, during simulation, the block produces outputs
and if appropriate, updates its internal state. The internal state
includes but is not limited to continuous and discrete states that
are logged.
Note
Do not confuse the Simulink usage of the term sample time
with the engineering sense of the term. In engineering, sample time
refers to the rate at which a discrete system samples its inputs. Simulink allows
you to model single-rate and multirate discrete systems and hybrid
continuous-discrete systems through the appropriate setting of block
sample times that control the rate of block execution (calculations). |
For many engineering applications, you need to control the rate
of block execution. In general, Simulink provides this capability
by allowing you to specify an explicit SampleTime parameter
in the block dialog or at the command line. Blocks that do not have
a SampleTime parameter have an implicit sample
time. You cannot specify implicit sample times. Simulink determines
them based upon the context of the block in the system. The Integrator block is an example of a block
that has an implicit sample time. Simulink automatically sets its
sample time to 0.
Sample times can be port-based or block-based. For block-based
sample times, all of the inputs and outputs of the block run at the
same rate. For port-based sample times, the input and output ports
can run at different rates.
Sample times can also be discrete, continuous, fixed in minor
step, inherited, constant, variable, triggered, or asynchronous. The
following sections discuss these sample time types, as well as sample
time propagation and rate transitions between block-based or port-based
sample times. You can use this information to control your block execution
rates, debug your model, and verify your model.
 | Working with Sample Times | | How to Specify the Sample
Time |  |
Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
Get this Simulink Kit