Weighted Sample Time
Support calculations involving sample time
Libraries:
Simulink /
Signal Attributes
Description
The Weighted Sample Time block outputs one of these values, depending on settings of the Operation and Weight value parameters and the execution context of the function that contains the block:
Weighted sample time –- When used in a periodic function, the weighted sample time is the sample time of an input signal (
Ts
times a weight valuew
, orTs * w
). When used in an aperiodic or triggered function, the weighted sample time is the elapsed time since the last execution times the specified weight value.Weighted sample rate –- When used in a periodic function, the weighted sample rate is the reciprocal of the weighted sample time or
1/(Ts * w)
. The weighted sample rate is not relevant when the block is used in an aperiodic function.Mathematically adjusted weighted sample time--- The block adds the value of an input signal
u
to, subtractsu
from, or multiplies or dividesu
by a weighted sample time.
You specify the block operation by using the Operation parameter.
The sample time used to derive the output depends on whether the block is used within a periodic or aperiodic (or triggered) execution context. For a periodic execution context, the block uses the sample time of the model. For an aperiodic or triggered execution context, the block uses the sample time of the discrete signal.
Use the Weight value parameter to specify the sample time weight factor.
If the weight value, w
, is 1
, that value does not
appear in the equation on the block icon.
Tip
You can use the Weighted
Sample Time and Weighted Sample Time Math blocks to extract
the sample time from a Simulink® signal. Set the Operation parameter to
Ts Only
and the Weight value
parameter to 1.0
. With this configuration, the block outputs the
sample time of the input signal.
The block computes its output by using the precedence rules for MATLAB® operators. For example, if the Operation parameter is set
to +
, the block calculates the output by using this expression:
u + (Ts * w)
If the Operation parameter is set to /
, the block
calculates the output by using this expression:
(u / Ts) / w
For more information, see Operator Precedence.
Ports
Input
Output
Parameters
Block Characteristics
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
Extended Capabilities
Version History
Introduced before R2006a