Main Content

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

转换和量化数据

量化为定点和浮点数据类型,在数据类型之间转换

设计定点算法时,请使用 castzerosoneseyesubsasgn 将核心算法与数据类型定义分隔开。这些函数允许您在同一代码中使用双精度、单精度和定点数据类型。Manual Fixed-Point Conversion Best Practices说明如何获得从泛型 MATLAB® 代码转换为高效定点实现。

要使用双精度仿真全精度算术,并仅在算法输出端进行量化,请使用 quantizenumeric

要仿真具有任意字长和指数长度的浮点数据,请使用 quantizer 对象和关联的对象函数。

函数

全部展开

eyeCreate identity matrix with fixed-point properties
ones用定点属性创建全为 1 的数组
zeros创建具有定点属性的全零数组
cast将变量转换为不同数据类型
cast64BitFiToIntCast fi object types that can be exactly represented to a 64-bit integer data type (自 R2020a 起)
cast64BitIntToFiCast 64-bit integer types to an equivalent fi object type (自 R2020a 起)
castFiToIntCast fi object to equivalent integer data type (自 R2020a 起)
castFiToMATLABCast fi object type to an equivalent built-in MATLAB data type (自 R2020a 起)
castIntToFiCast an integer data type to equivalent fi type (自 R2020a 起)
subsasgnSubscripted assignment
subsref下标引用
quantizenumericQuantize numeric data
quantizerCreate quantizer object
quantize使用 quantizer 对象量化数值数据
assignmentquantizerCreate quantizer object with fi object attributes
copyobjMake independent copy of quantizer object
randquantGenerate uniformly distributed, quantized random number using quantizer object
reset将对象重置为初始条件
unitquantizeQuantize numeric data using quantizer object except numbers within eps of +1
unitquantizerCreate unitquantizer object
denormalmaxquantizer 对象的最大反正规化量化数
denormalminSmallest denormalized quantized number for quantizer object
epsfiquantizer 对象的量化相对精度
exponentbiasquantizer 对象的指数偏置
exponentlengthExponent length of quantizer object
exponentmaxquantizer 对象的最大指数
exponentminquantizer 对象的最小指数
fractionlengthquantizer 对象的小数长度
getProperty values of object
lsbScaling of least significant bit of fi object, or value of least significant bit of quantizer object
rangefiquantizer 对象的数值范围
realmax最大正定点值或量化数
realmin正的最小正规化定点值或量化数
setSet or display property values for quantizer objects
tostringfifimathnumerictypequantizer 对象转换为字符串
wordlengthWord length of quantizer object
logreport量化报告
maxlogLog maximums
minlogLog minimums
noperationsNumber of quantization operations by quantizer object
noverflowsNumber of overflows
nunderflowsNumber of underflows
resetlogClear log for fi or quantizer object
bin2num使用 quantizer 对象将 2 的二进制补码字符串转换为数字
hex2numConvert hexadecimal string to number using quantizer object
num2bin使用 quantizer 对象将数字转换为二进制表示
num2hexConvert number to hexadecimal equivalent using quantizer object
num2int使用 quantizer 对象将数字转换为有符号整数
isequalDetermine whether real-world values of two fi objects are equal, or determine whether properties of two fimath, numerictype, or quantizer objects are equal
isfixedDetermine whether input is fixed-point data type
isfloat确定输入是否为浮点数据类型
isquantizer确定输入是否为 quantizer 对象
errmeanMean of quantization error
errpdfProbability density function of quantization error
errvar量化误差的方差
round使用 quantizer 对象将 fi 对象舍入到最接近的整数或舍入输入数据
fixed.QuantizerQuantize fixed-point numbers
quantizeQuantize fi values using fixed.Quantizer object

主题