Q:

Normalization of a signal in MATLAB

I have a signal in MATLAB
s = randn(1,1e6);

that is normalized in the following way:
s = s/sqrt(sum(abs(s .^2)) / 1e6);

I would be thankful if anyone could explain me why is the signal normalized in this way!

A:

Assuming that $N$ is the length of your signal $s$, the normalized signal $s_n$ is given by:
$$s_n = \dfrac{s}{\sqrt{\dfrac{\sum_{i=1}^{N}\left|s_i^2\right|}{N}}} $$
The denominator is nothing else than Root Mean Square value of your signal. Thus the code is doing a simple RMS normalization. 
You can think of it as a method of normalizing the average of your signal and still allowing for some peaks to clip it (instead of being set to 1). In other words the standard division by the maximum absolute value of your signal will always guarantee that the sample values will be within the range of $[-1;1]$, whereas RMS normalization doesn't.
This method is widely used for audio processing and speech processing. 

