How normalize works
Posted: Sun May 23, 2021 9:52 pm
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:
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.
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.
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!
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.5It 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.7Code: Select all
our array: 3, 1.5, -4
after normalizing: 0.75, 0.375, -1If 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!