matlabquantizer函数⽤法,Constructquantizerobject-。。。quantizer
Construct quantizer object
Syntax
q = quantizer
q = quantizer('PropertyName1',PropertyValue1,...)
q = quantizer(PropertyValue1,PropertyValue2,...)
q = quantizer(struct)
q = quantizer(pn,pv)
Description
q = quantizer creates a quantizer object
with properties set to their default values. To use this object to
quantize values, use the quantize method.
q = quantizer('PropertyName1',PropertyValue1,...) uses
property name/ property value pairs.
q = quantizer(PropertyValue1,PropertyValue2,...) creates
a quantizer object with the listed property values.
When two values conflict, quantizer sets the last
property value in the list. Property values are unique; you can set
the property names by specifying just the property values in the command.
q = quantizer(struct), where struct is
a structure whose field names are property names, sets the properties
named in each field name with the values contained in the structure.
q = quantizer(pn,pv) sets the named properties
specified in the cell array of character vectors pn to
the corresponding values in the cell array pv.
The quantizer object property values are
listed below. These properties are described in detail in quantizer Object Properties.
Property NameProperty ValueDescriptionmode'double'Double-precision mode. Override all other parameters.
'float'Custom-precision floating-point mode.
'fixed'Signed fixed-point mode.
'single'Single-precision mode. Override all other parameters.
'ufixed'Unsigned fixed-point mode.
roundmode'ceil'Round toward positive infinity.
'convergent'Round to nearest integer with ties rounding to nearest
even integer.
'fix'Round toward zero.
'floor'Round toward negative infinity.
'Nearest'Round to nearest integer with ties rounding toward positive
infinity.
'Round'Round to nearest integer with ties rounding to nearest
integer with greater absolute value.
overflowmode (fixed-point
only)'saturate'Saturate on overflow.
'wrap'Wrap on overflow.
format[wordlength fractionlength]Format for fixed or ufixed mode.
[wordlength exponentlength]Format for float mode.
The default property values for a quantizer object
are
DataMode = fixed
RoundMode = floor
OverflowMode = saturate
Format = [16 15]
Along with the preceding properties, quantizer objects
have read-only states: max, min, noverflows, nunderflows,
and noperations. They can be accessed through quantizer/get or q.maxlog, q.minlog, q.noverflows, q.nunderflows, perations, but they cannot be set. They
are updated during the quantizer/quantize method,
and are reset by the resetlog function.
The following table lists the read-only quantizer object
states:
Property NameDescriptionmaxMaximum value before quantizing
minMinimum value before quantizing
noverflowsNumber of overflows
nunderflowsNumber of underflows
noperationsNumber of data points quantized
Examples
The following example operations are equivalent.
Setting quantizer object properties by listing
property values only in the command,
q = quantizer('fixed', 'Ceiling', 'Saturate', [5 4])
Using a structure struct to set quantizer object
properties,
struct.overflowmode = 'saturate';
struct.format = [5 4];
q = quantizer(struct);
Using property name and property value cell arrays pn and pv to
set quantizer object properties,
pn = {'mode', 'roundmode', 'overflowmode', 'format'};object to
pv = {'fixed', 'ceil', 'saturate', [5 4]};
q = quantizer(pn, pv)
Using property name/property value pairs to configure a quantizer object, q = quantizer( 'mode', 'fixed','roundmode','ceil',...
'overflowmode', 'saturate', 'format', [5 4]);
Introduced before R2006a

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。