If I want to test a digital filter, is using white noise a good way? I mean input white noise to the filter, and visualize the frequency out from the output.

Is that procedure the same as testing a sine wave freq. by freq., to plot the freq. response.

Hope the question makes sense.


3 Answers 3


Yes you can also identify a system (more spcifically an LTI system) by inputing white noise to it and measuring the corresponding output. Yet this will be a statistical approach compared to the sine-wave measurement which is deterministic.

First, you have to be able to generate a WSS (wide-sense stationary) white noise of power $\sigma_x^2$ as the input $x[n]$ for testing.

Then you have to measure the output signal $y[n]$ and estimate it's power spectral density (PSD), assuming it's also WSS (which is indeed). So you will use some statistical approaches to obtain those quantities.

Then the relation between the input PSD of the white noise of power $\sigma_x^2$ and output PSD of the (colored) noise through the LTI is:

$$ S_{yy}(e^{j\omega}) = |H(e^{j\omega})|^2 S_{xx}(e^{j\omega}) $$

where $S_{xx}(e^{j\omega})$, and $S_{yy}(e^{j\omega})$ are the discrete-time input and output PSDs respectively. Since $S_{xx}(e^{j\omega}) = \sigma_x^2$ the output PSD will be:
$$ S_{yy}(e^{j\omega}) = |H(e^{j\omega})|^2 \sigma_x^2 $$

However, what is worth noting here is that, this method yields not the frequency response $H(e^{j\omega})$, but its magnitude square. So the phase information is lost.

A better approach, which yields the frquency response $H(e^{j\omega})$ directly is to use cross-correlation or cross-power spectral densities instead. The relation between input noise $x[n]$, output noise $y[n]$ can be expressed as

$$ S_{xy}(\omega) = H(\omega) S_{xx}(\omega) $$

Which shows a relation between input PSD and cross-PSD, and reveals $H(\omega)$ directly when input PSD is known as in the case with white-noise input PSD of $S_{xx}(e^{j\omega}) = \sigma_x^2$:

$$ S_{xy}(\omega) = \sigma_x^2 H(\omega). $$

Here the cross power spectral density, $S_{xy}(\omega)$ between the input $x[n]$ and the output $y[n]$ can be obtained through the DTFT of the cross-correlation between $x[n]$ and $y[n]$ from

$$\phi_{xy}[m] = \mathcal{E}\{x[n]y[n+m]^*\}$$

Which is indeed equivalent to the impulse response of the LTI system to be identified :

$$\phi_{xy}[m] = \sigma_x^2 h[m]$$


It depends on what you are doing. I use this method a lot to see if my digital filter is at least in the ballpark. However since the signal you are using is noisy, any spectra you compute will also be noisy, so you need to generate a lot of data to get a reasonably smooth spectrum. Here is an example where I generated 100 seconds of Gaussian (white noise) data at 10 kHz sample rate. I was testing a two-pole low-pass Butterworth filter at 100 Hz.

I took the spectrum with Welch windowing, 1 sec samples with 80% overlap, no detrending. The figure below shows the results. As the previous post mentioned, there is no phase information in this. If you want the time response of the filter, just run a digital delta function through and plot the response.enter image description here


A very basic demonstration using a direct dumb technique

clear all
close all
Zi=zeros( max(length(a),length(b))-1,1);
for i=1:runs
title(['Real      ',int2str(i),' averages'])

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.