File:Red-noise-density-animation.gif

Summary

Description
English: Animation of a red noise plot with changing sampling density. With increasing density, the trace converges to a thick, but limited band.
Date
Source Own work
Author Geek3
GIF development
InfoField
Source code
InfoField

Matplotlib source code

The plot was generated with Matplotlib
#! /usr/bin/env python3
# -*- coding:utf8 -*-

import matplotlib.pyplot as plt
from matplotlib import animation
import numpy as np
from math import *

plt.rcParams['font.sans-serif'] = 'DejaVu Sans'
np.random.seed(7)

fname = "Red-noise-density-animation"
nframes = 20
nsamples = 2**nframes+1
t0 = 1.
t = np.linspace(0, t0, nsamples)
randnorm = np.random.normal(0, 1, nsamples)
X = np.cumsum(randnorm / sqrt(nsamples))
X -= np.mean(X)
X /= np.std(X)

def animate(nframe):
    nframe = (nframe + 6) % nframes # start with frame 6
    plt.cla()
    dsample = 2**(nframes - nframe)
    plt.plot(t[::dsample], X[::dsample], '.-', markersize=4,
        label=f"$\Delta$t = 1/{nsamples//dsample:.0f}")
    plt.xlim(0, 1)
    plt.ylim(-3, 3)
    plt.grid(True)
    plt.xlabel('t')
    plt.ylabel('X')
    plt.legend(loc="upper center", framealpha=1)

fig = plt.figure(figsize=(520 / 90.0, 340 / 90.0), dpi=72)
plt.xlim(0, 1)
plt.ylim(-3, 3)
plt.grid(True)
plt.xlabel('t')
plt.ylabel('X')
plt.tight_layout()
anim = animation.FuncAnimation(fig, animate, frames=nframes)
anim.save(fname + '.gif', writer='imagemagick', fps=2)

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
Category:CC-BY-SA-4.0#Red-noise-density-animation.gif
Category:Self-published work Category:Red noise Category:Animations of stochastic processes Category:Brownian bridge Category:Wiener process
Category:Animations of stochastic processes Category:Brownian bridge Category:CC-BY-SA-4.0 Category:Red noise Category:Self-published work Category:Valid SVG created with Matplotlib code Category:Wiener process