# How can I design quantizer with MATLAB?

Status
Not open for further replies.

#### laperla

##### Full Member level 4
Hi
How can I design a 10-bit quantizer function that gets a
vector of decision levels errors?

you could just use the floor function:

y=floor(511*x)+511;

where x is your analog signal between [-1, +1] and y is your quantized signal between [0 and 1024] in this case.

• rezazarei

Points: 2

### rezazarei

Points: 2
V
Points: 2
What do you mean???
What are you looking for?

• rezazarei

### rezazarei

Points: 2
I want to write MATLAB program for design 10-bit quantizer function
Then write funcion for caculate IND and DNL

• rezazarei

### rezazarei

Points: 2
Well, the quantizer in my previous post is ideal so the DNL/INL will also be ideal.

If you want a "less" ideal quantizer you could implement a flash type as:
ref=[-512:511]/512;
fs=1e6; % sampling rate
f=31*fs/8192; input frequency, 31 is an odd number for coherent sampling, 8192 is the number of samples
x=sin(2*pi*f*(0:8191)/fs); % the input signal
for ii=1:8192
y(ii)=sum(x(ii)>ref); % the quantizer
end
plot then, using some immagination, you can add your non-linearities to the reference and see what happens to the DNL/INL

Status
Not open for further replies.