maxlog

Log maximums

Syntax

y = maxlog(a)
y = maxlog(q)

Description

y = maxlog(a) returns the largest 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 = maxlog(q) is the maximum value after quantization during a call to quantize(q,...) for quantizer object q. This value is the maximum value encountered over successive calls to quantize since logging was turned on, and is reset with resetlog(q). maxlog(q) is equivalent to get(q,'maxlog') and q.maxlog.

Examples

Example 1: Using maxlog with fi objects

P = fipref('LoggingMode','on');
format long g
a = fi([-1.5 eps 0.5], true, 16, 15);
a(1) = 3.0;
maxlog(a)

Warning: 1 overflow occurred in the fi 
assignment operation. 
> In embedded.fi.fi at 510
  In fi at 220

Warning: 1 underflow occurred in the fi
 assignment operation. 
> In embedded.fi.fi at 510
  In fi at 220

Warning: 1 overflow occurred in the fi 
assignment operation. 

ans =

         0.999969482421875

The largest value maxlog can return is the maximum 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

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

Example 2: Using maxlog with quantizer objects

q = quantizer;
warning on
format long g
x = [-20:10];
y = quantize(q,x);
maxlog(q)

Warning: 29 overflows.
> In embedded.quantizer.quantize at 74

ans =

		.999969482421875

The largest value maxlog can return is the maximum representable value of its input. You can obtain the range of x after quantization using the range function:

format long g
r = range(q)

r =

                        -1         0.999969482421875
Was this topic helpful?