.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_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_stochastic_processes_plot_white_noise_process.py: Create a white noise process ============================ .. GENERATED FROM PYTHON SOURCE LINES 7-27 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(\vect{s},\vect{t})=\delta(\vect{t}-\vect{s})C(\vect{s},\vect{s})` where :math:`C(\vect{s},\vect{s})` is the covariance matrix of the process at vertex :math:`\vect{s}` and :math:`\delta` the Kroenecker function. A process :math:`\varepsilon` is a white noise if all finite family of locations :math:`(\vect{t}_i)_{i=1, \dots, n} \in \mathbb{D}`, :math:`(\varepsilon_{\vect{t}_i})_{i=1, \dots, n}` is independent and identically distributed. The library proposes to model it through the object :class:`~openturns.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 29-32 .. code-block:: Python import openturns as ot import openturns.viewer as otv .. GENERATED FROM PYTHON SOURCE LINES 33-34 Define the distribution .. GENERATED FROM PYTHON SOURCE LINES 34-37 .. code-block:: Python sigma = 1.0 dist = ot.Normal(0.0, sigma) .. GENERATED FROM PYTHON SOURCE LINES 38-39 Define the mesh .. GENERATED FROM PYTHON SOURCE LINES 39-41 .. code-block:: Python tgrid = ot.RegularGrid(0.0, 1.0, 100) .. GENERATED FROM PYTHON SOURCE LINES 42-43 Create the process .. GENERATED FROM PYTHON SOURCE LINES 43-46 .. 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 47-48 Draw a realization .. GENERATED FROM PYTHON SOURCE LINES 48-53 .. code-block:: Python realization = process.getRealization() graph = realization.drawMarginal(0) graph.setTitle("Realization of a white noise with distribution N(0,1)") view = otv.View(graph) .. image-sg:: /auto_stochastic_processes/images/sphx_glr_plot_white_noise_process_001.svg :alt: Realization of a white noise with distribution N(0,1) :srcset: /auto_stochastic_processes/images/sphx_glr_plot_white_noise_process_001.svg :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 54-55 Draw a sample .. GENERATED FROM PYTHON SOURCE LINES 55-66 .. 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(k, drawable) view = otv.View(graph) .. image-sg:: /auto_stochastic_processes/images/sphx_glr_plot_white_noise_process_002.svg :alt: 5 realizations of a white noise with distribution N(0,1) :srcset: /auto_stochastic_processes/images/sphx_glr_plot_white_noise_process_002.svg :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 67-68 Display all figures .. GENERATED FROM PYTHON SOURCE LINES 68-69 .. code-block:: Python otv.View.ShowAll() .. _sphx_glr_download_auto_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 ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_white_noise_process.zip `