.. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_probabilistic_modeling_stochastic_processes_plot_white_noise_process.py: Create a white noise process ============================ This example details how to create and manipulate a white noise. A second order white noise :math:`\varepsilon: \Omega \times \mathbb{D} \rightarrow \mathbb{R}^d` is a stochastic process of dimension :math:`d` such that the covariance function :math:`C(\underline{s},\underline{t})=\delta(\underline{t}-\underline{s})C(\underline{s},\underline{s})` where :math:`C(\underline{s},\underline{s})` is the covariance matrix of the process at vertex :math:`\underline{s}` and :math:`\delta` the Kroenecker function. A process :math:`\varepsilon` is a white noise if all finite family of locations :math:`(\underline{t}_i)_{i=1, \dots, n} \in \mathbb{D}`, :math:`(\varepsilon_{\underline{t}_i})_{i=1, \dots, n}` is independent and identically distributed. The library proposes to model it through the object *WhiteNoise* defined on a mesh and a distribution with zero mean and finite standard deviation. If the distribution has a mean different from zero, The library writes message to prevent the User and does not allow the creation of such a white noise. .. code-block:: default from __future__ import print_function import openturns as ot import openturns.viewer as viewer from matplotlib import pylab as plt import math as m ot.Log.Show(ot.Log.NONE) Define the distribution .. code-block:: default sigma = 1.0 dist = ot.Normal(0.0, sigma) Define the mesh .. code-block:: default tgrid = ot.RegularGrid(0.0, 1.0, 100) Create the process .. code-block:: default process = ot.WhiteNoise(dist, tgrid) process .. raw:: html

WhiteNoise(Normal(mu = 0, sigma = 1))



Draw a realization .. code-block:: default realization = process.getRealization() graph = realization.drawMarginal(0) graph.setTitle('Realization of a white noise with distribution N(0,1)') view = viewer.View(graph) .. image:: /auto_probabilistic_modeling/stochastic_processes/images/sphx_glr_plot_white_noise_process_001.png :alt: Realization of a white noise with distribution N(0,1) :class: sphx-glr-single-img Draw a sample .. code-block:: default sample = process.getSample(5) graph = sample.drawMarginal(0) graph.setTitle(str(sample.getSize()) + ' realizations of a white noise with distribution N(0,1)') for k in range(sample.getSize()): drawable = graph.getDrawable(k) drawable.setLegend('realization ' + str(k+1)) graph.setDrawable(drawable, k) view = viewer.View(graph) plt.show() .. image:: /auto_probabilistic_modeling/stochastic_processes/images/sphx_glr_plot_white_noise_process_002.png :alt: 5 realizations of a white noise with distribution N(0,1) :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.178 seconds) .. _sphx_glr_download_auto_probabilistic_modeling_stochastic_processes_plot_white_noise_process.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_white_noise_process.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_white_noise_process.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_