Divide one input by another

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.

If any of the Divide block inputs contains a `NaN`

or `inf`

value,
or if the block generates `NaN`

or `inf`

during
execution, you might see different results when you compare the block
simulation results with the generated code. This difference is due
to the nonfinite `NaN`

or `inf`

values.
In such cases, inspect your model configuration and eliminate the
conditions that produce `NaN`

or `inf`

.

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.

Was this topic helpful?