# 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!

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.

• Okay, but if I have a signal, say a= randn(1,1e4) + irandn(1,1e4); I normalize it to power 1 by simply multiplying it by sqrt(0.5),i.e a= sqrt(0.5)*(randn(1,1e4) + irandn(1,1e4)); But now I want to normalize it to say power 3.9811e-06. Do you have any suggestions on how to do this? – rmb Oct 13 '15 at 15:10
• Is it OK to normalize by subtracting by the average of the signal? – zygimantus Jan 16 '16 at 15:55
• It is a completely different thing. You are talking about mean normalization (removal ). – jojek Jan 16 '16 at 16:07