MATLAB Answers

How map values of array to 0 and 1

13 views (last 30 days)
Eleanor Lee
Eleanor Lee on 6 Dec 2019
How can i write a function such that it takes an array, and outputs an array of same size with values lying in [0,1] but also that the largest value is mapped to 1, and smallest to 0?

  0 Comments

Sign in to comment.

Answers (2)

Jeremy Marcyoniak
Jeremy Marcyoniak on 6 Dec 2019
normalized_array = normalize(array,'range',[0 1]);

  0 Comments

Sign in to comment.


Guillaume
Guillaume on 6 Dec 2019
It's trivial normalisation. Subtract the minimum of your array so the new minimum is 0, then divide by the max of that new array so the max becomes 1.

  0 Comments

Sign in to comment.

Sign in to answer this question.