Simple 1/f noise generator

It’s often useful to be able to play around with things to get a feel for how they work. One of these is 1/f noise. There’s a very simple algorithm for generating this type of noise.

We set up n storage locations. To start a random value (-1 to 1) is stored in each location, Then every 2nd step, the first one changes to a new random value (-1 to +1), every 4th step the second changes, every 8th step the third, every 16th the fourth, etc. until the last one change in the middle of the run.

If we then set it so that at each step only one storage location is changing, then if we sum all the locations we have a random value that changes only by a random value between (-1 to +1) at each step.

For the equivalent of 10 years of daily readings we need ~4000 steps and when graphed for a scale of years we should have something like this:

1-fgeneratorI’ve included a openoffice calc file and xls

This entry was posted in Climate. Bookmark the permalink.

3 Responses to Simple 1/f noise generator

  1. Timo Soren says:

    After reviewing your xls programming it seems that 1/f noise is n-pieces of data where exactly one them is allowed to vary by some amount, but from a specific spectrum.

    I am not sure but it would be interesting how similar n columns with exactly one varying but not from a specific spectrum would look similar or not.

  2. Scottish-Sceptic says:

    That’s an interesting question. The high frequencies are dominated by the step change – and that would be similar irrespective of which column changed. But what would change is that pulses of low frequency won’t be around for as long as they are now (longer or shorter). I have a suspicion it would be much the same, but I would need to prove it.

    I’ve been attempting to create an 1/f^n noise generator using a similar pattern to the above. The difference is that whereas the above can only vary by a maximum of 2 (from -1 to +1), with any other pattern, there can be several locations changing at any one time leading to up to 2n change at each step.

    As far as I can tell the general pattern is similar, but there’s now a much greater probability of a large step. This is different, but it may not be “wrong” as there’s no clear understanding of what 1/f^n noise is, so there’s no clear understanding of whether a particular noise generator is “ideal” 1/f^n noise.

    I think the same would apply to your suggestion. It may have different behaviour but still give a 1/f noise spectrum.

  3. Timo Soren says:

    I ran several hundred and then compared them, they look very similar but as you said it appears that the ranges and shifts are larger, while your code also seems to allow longer runs of gentler increases.

    Fun to see this though.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>