Take the 2-minute tour ×
Physics Stack Exchange is a question and answer site for active researchers, academics and students of physics. It's 100% free, no registration required.

I've generated some white noise in Excel by using the formula

$$2*\mathrm{Math.RAND}()-1$$

I would now like to create some pink noise. I believe this is done by applying some sort of filter to the white noise, but I can't figure out how to do this.

P.S. White noise has a flat spectral density, but in pink noise frequency spectrum falls off as $\frac{1}{frequency}$. Any help is much appreciated!

share|improve this question
    
a low pass filter might help.... –  Vineet Menon Nov 12 '11 at 4:43
add comment

2 Answers

For pink noise, the power spectrum falls off as 1/f. Remember that power is amplitude squared. For an electrical signal, power is voltage across times current flowing through a load, and the current follows from Ohm's Law. It is possible to arrange resistors and capacitors as a low pass filter to make an approximation of pink noise, but it's not precise. (I have a schematic in my files somewhere. Nag me and I'll look for it.)

But your signal is a list of numbers in a computer - you are lucky! These numbers are like voltages. Take a Fourier transform (I don't know of Excel can do that) and you'll have amplitudes ordered by frequency. Divide each amplitude by the square root of its frequency. Then the inverse Fourier transform will give you a pink noise signal.

We use square roots because we want the power, which is amplitude squared, to be reduced by a factor of f. Of course, you may want to make an exception for zero frequency - just set its amplitude to zero, and maybe also the few lowest frequency amplitudes just avoid overflows or other trouble.

share|improve this answer
    
Lets say the displacement is x and I have 1000 sequential displacements (random numbers between -1 and 1). So if I take the Fourier Transform of this whole lot, that will give me the amplitudes ordered by frequency? Divide each by it's frequency, inverse FT and that's it? So am I right in thinking the challenge is finding a way to take a FT of a sequence of random numbers? –  Lars Nov 12 '11 at 16:54
1  
@Lars: just take a power of two sized collection of random numbers, and feed it to a standard FFT. You don't even need to do the first step because the Fourier transform of white noise is white noise--- just generate a power of two Gaussian distributed random numbers, arrange them to be in the centered frequency range $-\pi$ to $\pi$ divide by $\sqrt{f}$ and FFT. –  Ron Maimon Nov 12 '11 at 22:18
    
@RonMaimon I now realise about not needing to generate the white noise in the first place. However, the intensity of pink noise decreases with frequency as 1/f. So can I not just create an array of numbers with amplitude falling off like so then Inverse FFT? Why would I need power of two Gaussian distributed random numbers? And what does that actually mean? Square the random numbers? Thanks for the help so far, by the way! –  Lars Nov 14 '11 at 4:02
add comment

The terms "white noise" and "pink noise" are applied to noise that depends on a parameter. The equation you gave technically isn't noise at all--- it's a real number uniformly distributed between -1 and 1. But I will assume that you are calling the RAND function inside a routine, and that this routine is simulating some system in time, and every time step it adds the random number to the velocity or the acceleration in a differential equation. In this case, the RAND call becomes white noise in the short time-step limit.

It is easy to generate white-noise, because you don't need to know the previous values of the noise to get future values.

The pink noise with a 1/f spectrum is nonlocal, so you need to do an FFT on a long random sequence, divide by $\sqrt{f}$ and FFT back, as DarenW said. This requires you to store the entire sequence of random numbers in memory, and is very tedious. If you use a filter, it will be nonlocal in time, so you still need to store many random values to work with.

You can generate a non-pink version of colored noise by keeping a sum-variable s around in your program. Just let s=s+(2*RAND()-1) (but be careful--- this introduces a slight drift in s because RAND usually can return exactly zero internally, but never exactly 1. You can fix this by keeping a random sign variable around and subtracting the random quantity instead of adding when the sign is negative). The sum value s will have long-time correlations, and it's spectrum is a powerlaw that falls off like $1\over f^2$. Perhaps this will be sufficient for your needs--- it is certainly much easier numerically.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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