Support calculations involving sample time
Simulink / Signal Attributes
The Weighted Sample Time block outputs the weighted sample time or weighted
sample rate. Because the Weighted Sample Time block is an implementation
of the Weighted Sample Time Math, you can also
add, subtract, multiply, or divide the input signal, u
, by a weighted
sample time, Ts
. If the input signal is continuous,
Ts
is the sample time of the Simulink^{®} model. Otherwise, Ts
is the sample time of the discrete
input signal. If the input signal is constant, Simulink assigns a finite sample time to the block based on its connectivity and
context.
You specify the math operation with the Operation parameter. The block can output just a weighted sample time (Ts Only
) or a weighted sample rate (1/Ts Only
).
Enter the weighting factor in the Weight value parameter. If the weight, w
, is 1
, that value does not appear in the equation on the block icon.
You can use the Weighted Sample Time and Weighted Sample Time Math blocks to extract the sample time from a Simulink signal. To do so, set the Operation parameter to Ts
and the Weight value to 1.0
. In this configuration, the block outputs the sample time of the input signal.
The block computes its output using the precedence rules for MATLAB^{®} operators. See Operator Precedence (MATLAB) for information. For
example, if the Operation parameter specifies +
, the
block calculates output using this equation:
u + (Ts * w)
However, if the Operation parameter specifies /
, the block calculates output using this equation:
(u / Ts) / w
Data Types 

Direct Feedthrough 

Multidimensional Signals 

VariableSize Signals 

ZeroCrossing Detection 
