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

Thread Subject:
normalize value 0~1

Subject: normalize value 0~1

From: audley james

Date: 22 Feb, 2011 04:28:05

Message: 1 of 13

Hello all,

I would like to know of any approaches you guy know to normalize a value between 0 to 1. It is a single value I have , I have no knowledge of maximum or minimum extremes and such.

thanks
--Audley

Subject: normalize value 0~1

From: Wayne King

Date: 22 Feb, 2011 10:28:09

Message: 2 of 13

"audley james" <audleyer@gmail.com> wrote in message <ijve0l$54f$1@fred.mathworks.com>...
> Hello all,
>
> I would like to know of any approaches you guy know to normalize a value between 0 to 1. It is a single value I have , I have no knowledge of maximum or minimum extremes and such.
>
> thanks
> --Audley

Just to be clear... You have a single real-valued scalar and you want to normalize it between 0 and 1?

Wayne

Subject: normalize value 0~1

From: audley james

Date: 22 Feb, 2011 14:17:20

Message: 3 of 13

Wayne,

Yes, is this possible?

--audley

Subject: normalize value 0~1

From: audley james

Date: 22 Feb, 2011 14:20:18

Message: 4 of 13

Just to add, I am creating scoring functions. The values range from 0 to any positive number but I'd like to instead put this positive number in the 0 to 1 range.

--Audley

Subject: normalize value 0~1

From: Wayne King

Date: 22 Feb, 2011 14:30:28

Message: 5 of 13

"audley james" <audleyer@gmail.com> wrote in message <ik0gn2$2sc$1@fred.mathworks.com>...
> Just to add, I am creating scoring functions. The values range from 0 to any positive number but I'd like to instead put this positive number in the 0 to 1 range.
>
> --Audley

There's really no upper bound on the possible score? If the possible sample space is really the nonegative integers [0,\infty), then I don't see how you can normalize to [0,1].

wayne

Subject: normalize value 0~1

From: audley james

Date: 22 Feb, 2011 14:44:04

Message: 6 of 13

Wayne,

Let me know you thoughts on Method 1. of this website :

http://people.revoledu.com/kardi/tutorial/Similarity/Normalization.html

i.e. please see Equation 3 on the website.

regards,
Audley

Subject: normalize value 0~1

From: Paulo Silva

Date: 22 Feb, 2011 15:46:22

Message: 7 of 13

Here's a very simple way to do it

v=[1 5 6 7 8 9] %example data, all values are between 1 and 9
nv=v/max(v)% %normalized data, all values are between 0 and 1

Subject: normalize value 0~1

From: Think blue, count two.

Date: 27 Feb, 2011 17:05:50

Message: 8 of 13

On 22/02/11 8:20 AM, audley james wrote:
> Just to add, I am creating scoring functions. The values range from 0 to
> any positive number but I'd like to instead put this positive number in
> the 0 to 1 range.

Theoretical answer:

Divide the value by realmax()

Practical answer:

You cannot do it without unacceptable quantization, as Matlab has a
maximum precision rather than the infinite precision that would be
required to uniquely map [0 realmax] to [0 1]

Subject: normalize value 0~1

From: audley james

Date: 27 Feb, 2011 18:37:04

Message: 9 of 13

Good day

thanks for the help. But I not fully understanding . Could you please show me a very small example.

best regards,
james

Subject: normalize value 0~1

From: Steven_Lord

Date: 27 Feb, 2011 20:39:49

Message: 10 of 13



"audley james" <audleyer@gmail.com> wrote in message
news:ike5kg$bdm$1@fred.mathworks.com...
> Good day
> thanks for the help. But I not fully understanding . Could you please show
> me a very small example.

There are more representable IEEE double-precision numbers between 0 and 2
(for example) than there are between 0 and 1. How do you want to handle
that situation?

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: normalize value 0~1

From: Think blue, count two.

Date: 27 Feb, 2011 23:34:28

Message: 11 of 13

On 27/02/11 12:37 PM, audley james wrote:

> thanks for the help. But I not fully understanding . Could you please
> show me a very small example.

Steve's answer pointing out that [0,2] has more representable numbers
than [0,1] is correct. I will, though, expand a bit.

Your discussion has been framed in terms of not knowing that maximum
value that you might get.

When you are using IEEE 754 binary floating point numbers, that is
incorrect: IEEE 754 has a finite maximum value, which is 2^1024 *
(1-2^(-53)), which is the integer
179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368
In IEEE 754 binary floating point numbers, it is not possible to
represent any finite number larger than the above. Matlab gives the name
"realmax" to this value. Any value that would exceed the above is
truncated to the above number if it is within about 1E292 of the number;
anything above that yields the value "infinity".

Because there _is_ a maximum finite value for the values, the formulae
you were looking at do not apply. Instead, the formula that is
appropriate for your situation, to map [0, FixedMaximumValue] to [0,1]
is to divide your values by FixedMaximumValue; thus, divide all of your
data by realmax in order to map in to [0,1] . 0 divided by any quantity
is 0, and since there is no finite representable quantity greater than
realmax, the maximum you could get out of the division would be 1; we
thus establish that the mapping is correct.

However, only approximately 1/4 of the exactly representable IEEE 754
floating point numbers fall between [0,1]. Approximately 1/2 of the
representable numbers are negative, which you are not concerned about in
this case. Of the representable finite positive numbers, close to 1/2
are in [0,1] and the other half are in (1, realmax] . You are trying to
map 2*N values into N values. The only way you can do that is to do an
inexact mapping of half of those values.

Subject: normalize value 0~1

From: audley james

Date: 28 Feb, 2011 00:03:24

Message: 12 of 13

in my home country , Jamaica as they say : bomba clot!...google it

thanks guys.

Subject: normalize value 0~1

From: James

Date: 9 Aug, 2014 13:54:10

Message: 13 of 13

OP simply wants to normalize [0..+oo] to [0..1]
Obviously this cannot be a linear mapping.
There is an infinity of functions able to do that. Functions whom lim(+oo) is finite (horizontal asymptote).
For instance, using a sigmoid variant (mostly used in scoring):
2/(1+e^-x)-1 will do the trick.
See it in action:
http://fooplot.com/#W3sidHlwZSI6MCwiZXEiOiIyLygxK2VeKC14KSktMSIsImNvbG9yIjoiIzAwMDAwMCJ9LHsidHlwZSI6MTAwMH1d

"audley james" <audleyer@gmail.com> wrote in message <ikeooc$s3l$1@fred.mathworks.com>...
> in my home country , Jamaica as they say : bomba clot!...google it
>
> thanks guys.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us