Weighted Sample Time Math
Support calculations involving sample time
Libraries:
Simulink /
Math Operations
Description
The Weighted Sample Time Math block outputs one of these values, depending on the operation that you specify 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 value, orTs * w
). When used in an aperiodic or triggered function, the weighted sample time is the elapsed time since the last execution times a weight value.Weighted sample rate  When used in a periodic function, the weighted sample rate is the value 1 divided by the weighted sample time or
1/(Ts * w)
. 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 

VariableSize Signals 

ZeroCrossing Detection 

Extended Capabilities
Version History
Introduced before R2006a