Main Content

uminus

fi 对象数组的元素求反

语法

uminus(a)

说明

a 是对象时,为语法 -a 调用 uminus(a)-aa 的元素求反。

uminus 不支持数据类型为 Booleanfi 对象。

示例

发生绕回时,-(-1) = -1:

fipref('NumericTypeDisplay','short', ...
       'fimathDisplay','none');
format short g
a = fi(-1,true,8,7,'OverflowMode','wrap')
a = 

    -1
      numerictype(1,8,7)
-a
ans = 

    -1
      numerictype(1,8,7)
b = fi([-1-i -1-i],true,8,7,'OverflowMode','wrap')
b = 

           -1 -          1i           -1 -          1i
      numerictype(1,8,7)
-b
ans = 

           -1 -          1i           -1 -          1i
      numerictype(1,8,7)
b'
ans = 

           -1 -          1i
           -1 -          1i
      numerictype(1,8,7)

发生饱和时,-(-1) = 0.99...:

c = fi(-1,true,8,7,'OverflowMode','saturate')
c = 

    -1
      numerictype(1,8,7)
-c
ans = 

      0.99219
      numerictype(1,8,7)
d = fi([-1-i -1-i],true,8,7,'OverflowMode','saturate')
d = 

           -1 -          1i           -1 -          1i
      numerictype(1,8,7)
-d
ans = 

      0.99219 +    0.99219i      0.99219 +    0.99219i
      numerictype(1,8,7)
d'
ans = 

           -1 +    0.99219i
           -1 +    0.99219i
      numerictype(1,8,7)

扩展功能

C/C++ 代码生成
使用 MATLAB® Coder™ 生成 C 代码和 C++ 代码。

HDL 代码生成
使用 HDL Coder™ 为 FPGA 和 ASIC 设计生成 VHDL、Verilog 和 SystemVerilog 代码。

版本历史记录

在 R2006a 之前推出

另请参阅

| | |