Non uniform quantization block in simulink?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Is there non uniform quantization block available in any version of simulink?
I have tried to find in version 2013 but couldn't find non uniform quantization block there, although uniform quantization block was there
0 Kommentare
Antworten (1)
Andy Bartlett
am 22 Apr. 2021
Bearbeitet: Andy Bartlett
am 22 Apr. 2021
Flat Lookup
Lookup Table Using Flat Interpolation can be used for arbitrary quantization to a set of specified quantization values. Practically, you don't want the set of values to be too big.
The output vector and breakpoint vector for the lookup table can be defined like so. (Full code attached).
vecDesiredQuantizationValues = unique([
0.1
0.3
1.1
pi
]);
%
% For Lookup Table Flat Interpolation
% Set all the breakpoints to be in the middle of
% the two neighboring quantization values
% except the left more value.
% Just set that to the minimum output value
%
vecBreakPointsNearestViaFlatInterp = vecDesiredQuantizationValues;
vecBreakPointsNearestViaFlatInterp(2:end) = 0.5*(vecDesiredQuantizationValues(1:(end-1))+vecDesiredQuantizationValues(2:end));
A simple model to test this is attached.
The response of this model shows that quantization to the arbitrary set of values is achieved.
Alternate Approach Algorithm
If the number of values to quantize too is large, and you can describe the set of quantization values by math formulas, then an algorithm approach can be used.
Write down the equations, then synthesizes those equations using Simulink blocks, or via MATLAB code and put that in a MATLAB function block.
Example, quantize to values in the sequence
x_i = 1.35.^i for i is an integer from -10 to 10
This logrithmically spaced quantization could be implemented by this algorithm
function y = quantLogarithmic(u)
% Quantize to logarithmically spaced sequence
% x_i = 1.25.^i for i is an integer from -10 to 10
k = 1.35;
iLo = -10;
iHi = 10;
log2k = log2(k);
lo = k.^iLo;
hi = k.^iHi;
% Saturate extremes
%
u2 = min(hi,max(lo,u));
% Formula in log space
%
% log2(x_i) = log2( 1.125.^i )
% = i*log2( 1.125)
%
% i = log2(x_i) / log2(1.125)
i = round( log2(u2) ./ log2k );
y = k.^i;
end
This can be tested via the attached script test_quantLogarithmic which produces this graph.
Don't let the uniform spacing of the plot fool you. It is not uniform on regular linear spaced graph. The algorithmic approach is not limited to logarithmic spacing. It's only limited by your ability to manipulate your formulas and put the inner quantization in the right spot.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Quantizers finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!