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
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.