Error using quantiz The codebook must be a real vector whose length is one more than the length of the partition. How to resolve this issue in the following code attached?
Ältere Kommentare anzeigen
%Quantization
if quantization=='on '
if psychoacoustic=='off'
n=8;%default number of bits for each frame - sounds better but uses more bits
end
codebook = [min(C):(max(C)-min(C)/2^n):max(C)];
partition = [min(C):((max(C)-min(C))/2^n):max(C)];
[index,quant,distor] = quantiz(C,partition,codebook);
%find and correct offset
offset=0;
for j=1:1:N
if C(j)==0
offset=-quant(j);
break;
end
end
quant=quant+offset;
C=quant;
end
Antworten (1)
Torsten
am 23 Dez. 2022
codebook = [min(C):(max(C)-min(C))/2^n:max(C)];
instead of
codebook = [min(C):(max(C)-min(C)/2^n):max(C)];
5 Kommentare
Anupama V
am 23 Dez. 2022
Torsten
am 23 Dez. 2022
You choose codebook and partition to be equal.
And now read the error message.
Anupama V
am 23 Dez. 2022
Torsten
am 23 Dez. 2022
Yes, by adding one further element to "codebook".
Harismithra selvan
am 24 Dez. 2022
Can you send the code snippet ..
Kategorien
Mehr zu Signal Analysis finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!