主要内容

本页翻译不是最新的。点击此处可查看最新英文版本。

maxlog

记录最大值

语法

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

说明

y = maxlog(a) 返回自启用记录依赖或上次为对象重置日志以来 fi 对象 a 的最大真实值。

通过将 fipref 对象 LoggingMode 属性设置为 on 来启用记录。使用 resetlog 函数重置 fi 对象的记录。

y = maxlog(q) 是对 quantizer 对象 q 调用 quantize(q,...) 期间经过量化后的最大值。此值是自启用记录以来在连续调用 quantize 时遇到的最大值,并通过 resetlog(q) 重置。maxlog(q) 等效于 get(q,'maxlog')q.maxlog

示例

全部折叠

  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

    maxlog 可以返回的最大值是其输入的最大可表示值。在此示例中,a 是有符号 fi 对象,其字长为 16,小数长度为 15,范围为

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

  2. 您可以使用 range 函数获取任一 fi 对象 a 的数值范围:

    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

    maxlog 可以返回的最大值是其输入的最大可表示值。

  2. 您可以使用 range 函数获取量化后 x 的范围:

    format long g
    r = range(q)
    r =
    
                            -1         0.999969482421875

版本历史记录

在 R2006a 之前推出