Subtract two objects using `fimath`

object

`c = sub(F,a,b)`

`c = sub(F,a,b)`

subtracts objects `a`

and `b`

using `fimath`

object `F`

.
This is helpful in cases when you want to override the `fimath`

objects
of `a`

and `b`

, or if the `fimath`

properties
associated with `a`

and `b`

are
different. The output `fi`

object `c`

has
no local fimath.

`a`

and `b`

must both be `fi`

objects
and must have the same dimensions unless one is a scalar. If either `a`

or `b`

is
scalar, then `c`

has the dimensions of the nonscalar
object.

In this example, `c`

is the 32-bit difference
of `a`

and `b`

with fraction length
16.

a = fi(pi); b = fi(exp(1)); F = fimath('SumMode','SpecifyPrecision',... 'SumWordLength',32,'SumFractionLength',16); c = sub(F, a, b) c = 0.4233 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 32 FractionLength: 16

Was this topic helpful?