| Contents | Index |
Math 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:
Multiplication: Element-wise(.*)
Number of Inputs: */
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.
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.
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:
| Benefit | Small
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 releases | Yes | No | Yes |
| Reduced ROM and RAM usage, compared to R2011a and earlier releases | Yes, for real values | Yes, for real values | Yes, for real values |
| Reuse of variables | Yes | Yes | Yes |
| Dead code elimination | Yes | Yes | Yes |
| Constant folding | Yes | Yes | Yes |
| Expression folding | Yes | Yes | Yes |
| Consistency with MATLAB Coder results | Yes | Yes | Yes |
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.
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.
The following examples show the output of the Divide block for some typical inputs using default block parameter values.


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 |