How normalize works

Post any examples or modules that you want to share here
Post Reply
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

How normalize works

Post by tulamide »

Since I have reason to believe that some of you might not understand fully what normalizing does, here an explanation.

In general normalizing means to take a set of values and re-scale them (keeping their relative relationship intact), so that they end in the range of 0 to 1. In DSP however, we most often work bipolar, so here normalizing means the same, but for the range -1 to 1.

What normalizing does not do, is stretching or otherwise destroy the relationship of the values. This means, that you will not end up with an array that fills the peaks necessarily. Example:

Code: Select all

our array: 3, 1.5
after normalizing: 1, 0.5
When normalizing, you scan through the array to get the highest positive and lowest negative values, let's call both just "peaks". Whatever peak is going beyond the range the most is the key value, from which a percentage of reduction is calculated. In our example that's 3, and it has to be reduced by 2/3rds to fit into the -1 to 1 range. Now all other values are also reduced by 2/3rds, thus 1.5 becomes 0.5. This way the relationship, that value two is half of value one, keeps intact.

It will not stretch 1.5 to become -1! That's important to understand. That would destroy the established relationship of the values! As a result, our example array would never reach -1.

Code: Select all

our array: 3, 1.5, -2.1
after normalizing: 1, 0.5, -0.7
In this array, we reach -0.7, because 2.1 is still closer to -1 than 3 is to 1, and so 3 is still our key value.

Code: Select all

our array: 3, 1.5, -4
after normalizing: 0.75, 0.375, -1
Now finally we reach -1, but at the same time +1 isn't reached anymore. That's because -4 is now our new key value, and it is to be reduced to a quarter to reach -1, not to a third as before.

If you had the thought, normalizing would somehow make sure the values stretch over the whole range, I hope I could give you enough information as to why that is not the case.

Keep on developing!
"There lies the dog buried" (German saying translated literally)
User avatar
Spogg
Posts: 3368
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England
Contact:

Re: How normalize works

Post by Spogg »

Thank you!

This explanation is very welcome and, oddly, very pertinent for me right now ;)
User avatar
kortezzzz
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Re: How normalize works

Post by kortezzzz »

Thank you, tulamide, as always.
RJHollins
Posts: 1573
Joined: Thu Mar 08, 2012 7:58 pm

Re: How normalize works

Post by RJHollins »

Well described ... helpful examples [code]

Thanks tulamide 8-)
Post Reply