File:Red-noise-trace.svg

From testwiki
Jump to navigation Jump to search
    Original file (SVG file, nominally 520 × 340 pixels, file size: 24 KB)

    This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

    Summary

    Description
    English: Plot of sampled red noise with a power spectral density of 1/f². The noise was created by a random walk with normally distributed steps.
    Date
    Source Own work
    Author Geek3
    SVG development
    InfoField
     The SVG code is valid.
     This plot was created with Matplotlib.
    Source code
    InfoField

    Matplotlib source code

    The plot was generated with Matplotlib
    #! /usr/bin/env python3
    # -*- coding:utf8 -*-
    
    import matplotlib.pyplot as plt
    import numpy as np
    from math import *
    
    plt.rcParams['font.sans-serif'] = 'DejaVu Sans'
    np.random.seed(2)
    
    """
    red noise is identical to a Wiener process, that can be approximated by a
    random walk
    """
    
    nsamples = 501
    sigma = 1. # diffusion
    t0 = 1.
    t = np.linspace(0, t0, nsamples)
    
    dt = t[1:] - t[:-1]
    randnorm = np.random.normal(0, 1, nsamples)
    X = np.zeros_like(t)
    X[1:] = X[0] + np.cumsum(sigma * np.sqrt(dt) * randnorm[1:])
    X -= np.mean(X)
    X /= np.std(X)
    
    fig = plt.figure(figsize=(520 / 90.0, 340 / 90.0), dpi=72)
    plt.plot(t, X)
    plt.grid(True)
    plt.xlim(t[0], t[-1])
    plt.ylim(-2.6, 2.6)
    plt.xlabel('t')
    plt.ylabel('X')
    plt.tight_layout()
    plt.savefig('Red-noise-trace.svg')
    

    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.

    Captions

    Plot of sampled red noise

    Items portrayed in this file

    depicts

    5 December 2022

    image/svg+xml

    25,075 byte

    93936f04a332f89a9002999f294d7a1de2fae5cd

    File history

    Click on a date/time to view the file as it appeared at that time.

    Date/TimeThumbnailDimensionsUserComment
    current18:57, 5 December 2022Thumbnail for version as of 18:57, 5 December 2022520 × 340 (24 KB)wikimediacommons>Geek3Uploaded own work with UploadWizard

    There are no pages that use this file.