Main Content

maxlog

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

collapse all

  1. 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(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 =
    
             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(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
    format long g
    x = [-20:10];
    y = quantize(q,x);
    maxlog(q)
    Warning: 29 overflow(s) occurred in the fi quantize operation. 
    > In embedded.quantizer/quantize (line 81) 
    
    ans =
    
             0.999969482421875

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

Version History

Introduced before R2006a