.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_probabilistic_modeling/stochastic_processes/plot_white_noise_process.py" .. LINE NUMBERS ARE GIVEN BELOW. .. 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 ============================ .. GENERATED FROM PYTHON SOURCE LINES 6-26 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. .. GENERATED FROM PYTHON SOURCE LINES 28-34 .. code-block:: default 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) .. GENERATED FROM PYTHON SOURCE LINES 35-36 Define the distribution .. GENERATED FROM PYTHON SOURCE LINES 36-39 .. code-block:: default sigma = 1.0 dist = ot.Normal(0.0, sigma) .. GENERATED FROM PYTHON SOURCE LINES 40-41 Define the mesh .. GENERATED FROM PYTHON SOURCE LINES 41-43 .. code-block:: default tgrid = ot.RegularGrid(0.0, 1.0, 100) .. GENERATED FROM PYTHON SOURCE LINES 44-45 Create the process .. GENERATED FROM PYTHON SOURCE LINES 45-48 .. code-block:: default process = ot.WhiteNoise(dist, tgrid) process .. raw:: html

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



.. GENERATED FROM PYTHON SOURCE LINES 49-50 Draw a realization .. GENERATED FROM PYTHON SOURCE LINES 50-55 .. 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-sg:: /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) :srcset: /auto_probabilistic_modeling/stochastic_processes/images/sphx_glr_plot_white_noise_process_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 56-57 Draw a sample .. GENERATED FROM PYTHON SOURCE LINES 57-67 .. 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-sg:: /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) :srcset: /auto_probabilistic_modeling/stochastic_processes/images/sphx_glr_plot_white_noise_process_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.181 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 `_