minlog

y = minlog(a)
y = minlog(q)

Description

y = minlog(a) returns the smallest real-world value of fi object a since logging was turned on or since the last time the log was reset for the object.

Turn on logging by setting the fipref object LoggingMode property to on. Reset logging for a fi object using the resetlog function.

y = minlog(q) is the minimum value after quantization during a call to quantize(q,...) for quantizer object q. This value is the minimum value encountered over successive calls to quantize since logging was turned on, and is reset with resetlog(q). minlog(q) is equivalent to get(q,'minlog') and q.minlog.

Examples

collapse all

1. P = fipref('LoggingMode','on');
a = fi([-1.5 eps 0.5], true, 16, 15);
a(1) = 3.0;
minlog(a)
Warning: 1 overflow(s) occurred in the fi assignment operation.
> In embedded.fi/fifactory
In fi (line 226)
Warning: 1 underflow(s) occurred in the fi assignment operation.
> In embedded.fi/fifactory
In fi (line 226)
Warning: 1 overflow(s) occurred in the fi assignment operation.

ans =

-1

The smallest value minlog can return is the minimum representable value of its input. In this example, a is a signed fi object with word length 16, fraction length 15 and range:

 -1 ≤ x ≤ 1 – 2-15 (1)

2. You can obtain the numerical range of any fi object a using the range function:

format long g
r = range(a)
r =

-1         0.999969482421875

DataTypeMode: Fixed-point: binary point scaling
Signedness: Signed
WordLength: 16
FractionLength: 15
1. q = quantizer;
warning on
x = [-20:10];
y = quantize(q,x);
minlog(q)
Warning: 29 overflow(s) occurred in the fi quantize operation.
> In embedded.quantizer/quantize (line 81)

ans =

-1

The smallest value minlog can return is the minimum representable value of its input.

2. You can obtain the range of x after quantization using the range function:

format long g
r = range(q)
r =

-1         0.999969482421875 