# Variance of a filtered signal

I'm using a very simple 1st order Butterworth Filter shown in Matlab code:

order = 1;
cutOff = 0.1;
[b, a] = butter(order, (2*cutOff)/SampleRate, 'high');


So from the Matlab documentation of butter, it is not hard to know the transfer function is:

$$H(z) = \frac{b_1 + b_2z^{-1}}{a_1 + a_2z^{-1}}$$

The question is, if I have a signal $x$ with variance $v$, after the signal $x$ is filtered by the above high-pass filter, what is the variance of the output signal? Will it change? How can I calculate it? And is the filter linear?

• What do you call the variance of a signal ? – Yves Daoust Oct 9 '15 at 8:36
• Do you mean the symbol of the variance? 'v' as mentioned in the question? Or what do you mean? – Hongwei Oct 9 '15 at 8:52
• How do you define/compute the variance of a signal ? A signal is infinite. – Yves Daoust Oct 9 '15 at 8:53
• The signal is actually a discrete measured data from a sensor. So there is some information provided, for example output noise density. So I think the variance of the signal is just the variance of noise. Isn't it? – Hongwei Oct 9 '15 at 8:56
• Noise is the difference between the true signal and random perturbations. So the signal variance is precisely not the variance of noise. Is your question about noise ? – Yves Daoust Oct 9 '15 at 9:02

Your question (as expanded in the comments) is asking if we start with $$x(t) = x_{\rm true}(t) + n_1(t)$$ and filtering it using a filter $H(\omega)$ to get $$x_{\rm hp}(t) = h(t) * x(t) = x_{\rm true}(t) + n_2(t)$$ where the variance of $n_1$ is $v_1$, then what is $v_2$, the variance of $n_2$?

That seems ill-posed because the filter $H$ will change $x_{\rm true}$ as well as the noise.

This page looks at the problem when $x_{\rm true}(t) = 0,\ \forall t$.

Here it is assumed that $n_1$ is white noise.

Where they get it is that $$r_{x_{\rm hp}}(l) = v_1 \cdot (h * h)(l)$$ and $v_2$ is just this evaluated at $l=0$ i.e. $$v_2 = r_{x_{\rm hp}}(0)$$

So you need to find the impulse response of your filter, convolve it with itself and find the zero-lag value of this.

As I said above, this doesn't quite answer your question but it might be a start.

• It's important to realize that this result is only true for white noise, not for colored noise. – Matt L. Oct 9 '15 at 12:43
• Good point! Let me clarify, though the OP does state that in the comments: I suppose the noise before filter is white noise.. – Peter K. Oct 9 '15 at 13:20
• The answer doesn't really solve my problem. But yes, as you said, this is the best direction and start for thinking how to solve the problem. – Hongwei Oct 14 '15 at 7:27

This answer is not fundamentally different from the others; it's more of a complement and addendum. If $n(t)$ is zero-mean white Gaussian noise, then its variance is actually infinite; its power spectral density is constant and often denoted $\mathcal P_n(f)=N_0/2$. If this noise is input into a filter with impulse response $h(t)$, then the power spectral density of the filter's output $y(t)$ is $\mathcal P_y(f)=\mathcal P_n(f)|H(f)|^2=\frac{N_0}{2}|H(f)|^2$, where $H(f)$ is the Fourier transform of $h(t)$. Since the noise has zero mean, the output of the filter has variance given by $$\sigma^2=\frac{N_0}{2}\int_{-\infty}^\infty |H(f)|^2\,df.$$

In particular, if the filter is ideal with bandwidth $B$, the variance of the noise at its output is $N_0B$.

• This is only true for continuous time processes, where as you say the PSD is constant so it is not integrable, and the autocorrelation is a dirac delta at Zero. But for discrete processes the discrete delta is a well defined function, and I think we was going for a digital filter. But Yeah your formula is the continuous time representation of the Wiener-Khinchin theorem. – bone Oct 9 '15 at 14:02
• @bone, yes, thanks for pointing that out. – MBaz Oct 9 '15 at 15:33

I think in general you have to consider your signal as a stochastic process, so you not only have a variance $\sigma_x^2$ , but you have an entire autocorrelation sequence for $x(n)$, $r_x(t) = E[x(n)x(n-t)]$. So what you need to think about is to obtain the autocorrelation sequence of the output of your signal passed through the filter. This is not hard to obtain, I'll leave it for you to search how to do it, but you might find it useful to search for the the "Wiener–Khinchin theorem". Basically it holds that if you transform your autocorrelation function with the Fourier transform, you obtain the power spectral density in the frequency domain, this power spectrum gets filtered by the frequency response of the filter, and the result is the power spectrum of the output, which you can then inverse transform and obtain the autocorrelation of the output. $r_x(0)$ will be the variance at the output. It will probably change depending on the form of the filter, and if it is a passive filter (no gain greater than unity at any frequency) your variance will reduce, because the variance is the integral of the power spectrum from $-\pi$ to $\pi$ and if you are attenuating some part of the spectrum you are reducing the energy in that part. Anyway, hope it helps.

Cheers