i have a signal sine wave with an amplitude of -1 db The quantizer step Δ is 1/7. The middle quantization level is 0 and the other levels are ±kΔ,, k=1-7. the output is 4-bit unsigned integer which values from 0 to 14 corresponding to the 15 quantization levels. how i can do this in matlab

  • \$\begingroup\$ -1dB with respect to WHAT? \$\endgroup\$ – user_1818839 May 12 '20 at 17:30
  • \$\begingroup\$ what am asking is how to create a uniform quantizer that has 15 level , and 0 is the middle level and other levels is k*delta , with a step of delta=1/7 \$\endgroup\$ – ayyoub May 12 '20 at 17:47
  • \$\begingroup\$ You've just repeated what is in your question and haven't answered the comment. \$\endgroup\$ – Transistor May 12 '20 at 19:32
  • \$\begingroup\$ - 1 db in amplitude it will be AM=10^(-1/20); signal = AMsin(2*pif*nT); \$\endgroup\$ – ayyoub May 12 '20 at 20:17
  • \$\begingroup\$ So. 0.89, right? What is that in LSB (quantizer steps)? \$\endgroup\$ – user_1818839 May 12 '20 at 21:44

With simulink, use the quantizer block: https://www.mathworks.com/help/simulink/slref/quantizer.html

The same page describes the "matlab script" equivalent:

y = q * round(u/q)
where y is the quantized output, u is the input, and q is the Quantization interval.

This will provide an output in the same units as input. If you wish for the output to be a raw quantization count, just remove the multiplication by quantization interval.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.