Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Confusion about quantization noise calculation

Status
Not open for further replies.

Julian18

Full Member level 3
Joined
Apr 9, 2007
Messages
167
Helped
5
Reputation
10
Reaction score
5
Trophy points
1,298
Activity points
2,389
Hello there:
I am constructing a naive quantizer using matlab, with LSB=1. The output waveform seems good. but when I calculate the total quantization noise power, I fail to get a number that is around 1/12= 0.0833, on the contrary i always get 1/6=1.672. I know I must have done something very silly, so plz help me out there.
the matlab code is listed below as
clear x y ref;
N=8192*4;
ref=[-3.5:2.5];
x=rand(1,N)*8-4.5;
for i=1:N
y(i)=sum(x(i)>ref);​
QN(i)=y(i)-4-x(i);​
end
%QN=y-4-x;
s=abs(fft(QN));
s=s(1:end/2)/N*2;
sum(s.^2)
below shown are the quantization waveform and its spectrum

19_1292577996.png

Thanks
 
Last edited:

... I fail to get a number that is around 1/12= 0.0833, on the contrary i always get 1/6=1.672. I know I must have done something very silly

Just a guess: s=s(1:end/2)/N*2; Does it divide or multiply by 2 ?
Of course this makes a quotient of 4 in the result, but perhaps the above given numbers represent the sqrt?
 
Just a guess: s=s(1:end/2)/N*2; Does it divide or multiply by 2 ?
Of course this makes a quotient of 4 in the result, but perhaps the above given numbers represent the sqrt?

Hi erikl
I think it is multiplied by 2; cause what I really want is to divide s by N/2 which leads s to be divided by N and multiplied by 2;
 

I think it is multiplied by 2; cause what I really want is to divide s by N/2 which leads s to be divided by N and multiplied by 2;

Yes, I think this is correct: Division and multiplication usually own the same priority, and operations of the same priority are performed from left to right. You could make sure, however, by using brackets.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top