# How to scale a signal to get desired variance [duplicate]

I am new to dsp, and I'd really appricate it if someone please help me with this problem. I guess it's a basic simple question, but I cannot get it write. Here is the question:

The variance of a random signal generated using MATLAB command randn is approximately 1. We need a random signal with variance 0.01. With which factor you need to scale the signal?

With amplitude? Like we need to multiple the amplitude of the signal by 0.1?

## marked as duplicate by Matt L., MBaz, A_A, Stanley Pawlukiewicz, lennon310Nov 12 '18 at 4:56

• Assuming you want a normal independent RV sqrt(var)*randn. – Stanley Pawlukiewicz Nov 11 '18 at 17:35
• I need to scale the signal with this sqrt(var)*randn? Why? – Niousha Nov 11 '18 at 18:48
• Because it answered the question you asked. Google "standardizing a random variable" and work backwards – Stanley Pawlukiewicz Nov 11 '18 at 21:53

In a practical setting to adjust the variance (thereof the power) of a random process, you could use the following to get what you want.

Let the variance of a given RV $$X$$ be $$\text{Var}\{X\} = \sigma_X^2$$

Then the following transform $$Y = K X$$ ($$K$$ being a scalar) will define a RV $$Y$$ with a variance given by

$$\text{Var}\{Y\} = \text{Var}\{ K X\} = K^2 \text{Var}\{ X\} = K^2 \sigma_X^2 = \sigma_Y^2$$

So, given a variance of $$\sigma_X^2$$ and a desired variance of $$\sigma_Y^2$$, you shall compute the necessary gain $$K$$ as

$$K = \frac{ \sigma_Y }{\sigma_X}$$

standardizing a Normal random variable $$x$$ $$\frac{x -m}{\sigma} \sim \mathcal{N}(0,1)$$ so if $$y$$ is a random variable that is Normal with mean zero, with standard deviation $$1$$, $$\sqrt{\sigma^2}y \sim \mathcal{N}(0, \sigma^2)$$ This standardization actually works for more than just Normal Distributions.