Skip to Main Content Skip to Search
Product Documentation

Divide - Divide one input by another

Library

Math Operations

Description

Supported Block Operations

The Divide block outputs the result of dividing its first input by its second. The inputs can be scalars, a scalar and a nonscalar, or two nonscalars that have the same dimensions. The Divide block is functionally a Product block that has two block parameter values preset:

Setting non-default values for either of those parameters can change a Divide block to be functionally equivalent to a Product block or a Product of Elements block. See the documentation of those two blocks for more information.

Expected Differences Between Simulation and Code Generation

The generated code might not produce the exact same pattern of NaN and inf values as simulation when these values are mathematically meaningless. For example, if the simulation output contains a NaN, output from the generated code also contains a NaN, but not necessarily in the same place.

Code Optimizations

The Simulink Coder build process provides efficient code for matrix inverse and division operations. The following summary describes the benefits and when each benefit is available:

BenefitSmall matrices
(2-by-2 to 5-by-5)
Medium matrices
(6-by-6 to 20-by-20)
Large matrices
(larger than 20-by-20)
Faster code execution time, compared to R2011a and earlier releasesYesNoYes
Reduced ROM and RAM usage, compared to R2011a and earlier releasesYes, for real valuesYes, for real valuesYes, for real values
Reuse of variablesYesYesYes
Dead code eliminationYesYesYes
Constant foldingYesYesYes
Expression foldingYesYesYes
Consistency with MATLAB Coder resultsYesYesYes

For blocks that have three or more inputs of different dimensions, the code might include an extra buffer to store temporary variables for intermediate results.

Parameters and Dialog Box

The Divide block has the same parameters and dialog box as the Product block. If all you need is to divide two inputs to create an output, you can use the Divide block with default parameter values. If you need additional capabilities, see the Product block documentation, which also describes the capabilities of the Divide block's Signal Attributes Pane.

Examples

The following examples show the output of the Divide block for some typical inputs using default block parameter values.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS