.. 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 :ref:`Go to the end ` 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:: Python import openturns as ot import openturns.viewer as viewer from matplotlib import pylab as plt 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:: Python 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:: Python 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:: Python process = ot.WhiteNoise(dist, tgrid) process .. raw:: html
class=WhiteNoise distribution=class=Normal name=Normal dimension=1 mean=class=Point name=Unnamed dimension=1 values=[0] sigma=class=Point name=Unnamed dimension=1 values=[1] correlationMatrix=class=CorrelationMatrix dimension=1 implementation=class=MatrixImplementation name=Unnamed rows=1 columns=1 values=[1]


.. GENERATED FROM PYTHON SOURCE LINES 49-50 Draw a realization .. GENERATED FROM PYTHON SOURCE LINES 50-55 .. code-block:: Python 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-68 .. code-block:: Python 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 .. _sphx_glr_download_auto_probabilistic_modeling_stochastic_processes_plot_white_noise_process.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_white_noise_process.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_white_noise_process.py `