Mapping continuous values onto a discrete spectrum

I have an assignment I am really struggling with. We have a gray scale image (dimensions: AxBx1)). When given a number N, the number of intervalls, we are supposed to map all values to a single number. Here is an example for N=4:
[0.00 - 0.25] mapped to 0
[0.25 - 0.50] mapped to 0.3 repeating
[0.50 - 0.75] mapped to 0.6 repeating
[0.75 - 1.00] mapped to 1
I have figured out that if given the number N, then I need N-1 values to map those intervalls to. All I need is a function or some other way to do so, because we are not allowed to use loops or recursion. And I have no idea how to even begin programming this. I have already looked googled and couldn't find a answer.

Answers (0)

Asked:

on 14 Jun 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!