You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following model demonstrates that the quantization function may output more levels than the number of bits allows, which is $2^\text{bits}$. The quantization is here set to 2 bits, allowing for 4 distinct output levels
However, the number of unique output levels is 5:
The underlying models seems to have several issues:
An off-by-one error as shown by this model. Resolution is the difference between levels, so if we want 2^bits levels there are 2^bits-1 differences.
Complicated and broken logic:
Having abs and sign-information seems weird, especially when allowing non-symmetric limits, e.g., set yMin=-1.1 and yMax=1.0; and see that the quantized result goes from -1.1 to +1.1 (which exceeds the limit)!
In general having the limits before quantization has the risk that quantization breaks the limits.
A better variant seems to be: y = resolution*floor((u-yMin)/resolution+0.5)+yMin; and parameter Real resolution = if quantized then ((yMax - yMin)/(2^bits-1)) else 0;, but I don't know how such devices are normally built.
Note that the problem gets worse as the number of bits decreases; and it seems no-one counted the 257 levels for the default setting.
However, having non-symmetric limits isn't considered on that page; and I assume most people who use a non-symmetric limit in practice use it for a non-negative limit (such as yMin=0, yMax=255).
The following model demonstrates that the quantization function may output more levels than the number of bits allows, which is$2^\text{bits}$ . The quantization is here set to 2 bits, allowing for 4 distinct output levels
However, the number of unique output levels is 5:
Full model, implemented with OpenModelica
The text was updated successfully, but these errors were encountered: