Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Problem 263. Nonuniform quantizer as a piecewise constant function

Created by Steve Eddins

Implement a nonuniform quantizer as the following piecewise function:

y = -3.5, x < 3

y = -1.5, -3 ≤ x < -1

y = -0.5, -1 ≤ x < 0

y = 0.5, 0 ≤ x < 1

y = 1.5, 1 ≤ x < 3

y = 3.5, 3 ≤ x

Your function should act elementwise on array inputs.

For example:

   nonuniformQuantizer([-4.0 0.0 2.0])

returns

   [-3.5 0.5 1.5]

Tags

Problem Group

Solution Statistics

44 correct solutions 47 incorrect solutions
Last solution submitted on Jun 10, 2014