| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink |
| Contents | Index |
| Learn more about Simulink |
Math Operations

The Weighted Sample Time Math block adds, subtracts, multiplies, or divides its 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.
You specify the math operation with the Operation parameter. Additionally, you can specify to use only the weight with either the sample time or its inverse.
Enter the weighting factor in the Weight value parameter. If the weight, w, is 1, Simulink software refrains from displaying it in the equation on the block icon.
The block computes its output using the precedence rules for MATLAB operators (see Operator Precedence). 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
The Weighted Sample Time Math block accepts signals of any numeric data type supported by Simulink software, including fixed-point data types.
The Main pane of the Weighted Sample Time Math block dialog box appears as follows:

Specify operation to use: +, -, *, /, Ts Only, or 1/Ts Only.
Enter weight of sample time.
Specify online calculations or offline scaling adjustment. This parameter is visible only if you specify * or / as the Operation parameter.
The Signal Attributes pane of the Weighted Sample Time Math block dialog box appears as follows:

Specify whether the block inherits the output data type by an internal rule or back propagation.
Select the rounding mode for fixed-point operations. For more information, see Rounding in the Simulink Fixed Point User's Guide.
Select to have fixed-point overflows saturate. Otherwise, they wrap.
When you select this check box, saturation applies to every internal operation on the block, not just the output or result. In general, the code generation process can detect when overflow is not possible, in which case, no saturation code is necessary.
This parameter is visible only if:
The Operation parameter specifies + or -.
The Operation parameter specifies * or / and the Implement using parameter specifies Online Calculations.
Direct Feedthrough | For all math operations options except Ts and 1/Ts |
Scalar Expansion | No, the weight is always a scalar |
![]() | Weighted Sample Time | While Iterator | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |