.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/01_temporalTimeSeriesAnalysis/plot_whiteNoiseExample.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_01_temporalTimeSeriesAnalysis_plot_whiteNoiseExample.py: Generation of Gaussian White Noise ================================== .. GENERATED FROM PYTHON SOURCE LINES 7-9 Import requirements ------------------- .. GENERATED FROM PYTHON SOURCE LINES 9-14 .. code-block:: Python import os import numpy as np import plotly.graph_objects as go .. GENERATED FROM PYTHON SOURCE LINES 15-17 Define variables ----------------- .. GENERATED FROM PYTHON SOURCE LINES 17-23 .. code-block:: Python srate = 1 T = 500 sigma = 1.0 .. GENERATED FROM PYTHON SOURCE LINES 24-27 Create white noise ------------------ .. GENERATED FROM PYTHON SOURCE LINES 27-32 .. code-block:: Python time = np.arange(0, T, 1.0/srate) N = len(time) w = np.random.normal(loc=0, scale=sigma, size=N) .. GENERATED FROM PYTHON SOURCE LINES 33-36 Plot white noise ---------------- .. GENERATED FROM PYTHON SOURCE LINES 36-49 .. code-block:: Python fig = go.Figure() trace = go.Scatter(x=time, y=w, mode="lines+markers") fig.add_trace(trace) fig.update_layout(xaxis=dict(title="Time (sec)"), yaxis=dict(title="x")) if not os.path.exists("figures"): os.mkdir("figures") fig.write_html("figures/whiteNoise.html") fig.write_image("figures/whiteNoise.png") fig .. raw:: html


.. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.730 seconds) .. _sphx_glr_download_auto_examples_01_temporalTimeSeriesAnalysis_plot_whiteNoiseExample.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_whiteNoiseExample.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_whiteNoiseExample.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_whiteNoiseExample.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_