.. 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_functional_basis_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_functional_basis_process.py: Create a functional basis process ================================= .. GENERATED FROM PYTHON SOURCE LINES 6-35 The objective of this example is to define :math:`X: \Omega \times \mathcal{D} \rightarrow \mathbb{R}^d` a multivariate stochastic process of dimension :math:`d` where :math:`\mathcal{D} \in \mathbb{R}^n`, as a linear combination of :math:`K` deterministic functions :math:`(\phi_i)_{i=1,\dots,K}: \mathbb{R}^n \rightarrow \mathbb{R}^d`: .. math:: \begin{aligned} X(\omega,\underline{t})=\sum_{i=1}^KA_i(\omega)\phi_i(\underline{t}) \end{aligned} where :math:`\underline{A}=(A_1,\dots, A_K)` is a random vector of dimension :math:`K`. We suppose that :math:`\mathcal{M}` is discretized on the mesh :math:`\mathcal{M}` which has :math:`N` vertices. A realization of :math:`X` on :math:`\mathcal{M}` consists in generating a realization :math:`\underline{\alpha}` of the random vector :math:`\underline{A}` and in evaluating the functions :math:`(\phi_i)_{i=1,\dots,K}` on the mesh :math:`\mathcal{M}`. If we note :math:`(\underline{x}_0, \dots, \underline{x}_{N-1})` the realization of :math:`X`, where :math:`X(\omega, \underline{t}_k) = \underline{x}_k`, we have: .. math:: \begin{aligned} \forall k \in [0, N-1], \quad \underline{x}_k = \sum_{i=1}^K\alpha_i\phi_i(\underline{t}_k) \end{aligned} .. GENERATED FROM PYTHON SOURCE LINES 37-42 .. code-block:: Python import openturns as ot import openturns.viewer as viewer ot.Log.Show(ot.Log.NONE) .. GENERATED FROM PYTHON SOURCE LINES 43-44 Define the coefficients distribution .. GENERATED FROM PYTHON SOURCE LINES 44-49 .. code-block:: Python mu = [2.0] * 2 sigma = [5.0] * 2 R = ot.CorrelationMatrix(2) coefDist = ot.Normal(mu, sigma, R) .. GENERATED FROM PYTHON SOURCE LINES 50-51 Create a basis of functions .. GENERATED FROM PYTHON SOURCE LINES 51-55 .. code-block:: Python phi_1 = ot.SymbolicFunction(["t"], ["sin(t)"]) phi_2 = ot.SymbolicFunction(["t"], ["cos(t)^2"]) myBasis = ot.Basis([phi_1, phi_2]) .. GENERATED FROM PYTHON SOURCE LINES 56-57 Create the mesh .. GENERATED FROM PYTHON SOURCE LINES 57-59 .. code-block:: Python myMesh = ot.RegularGrid(0.0, 0.1, 100) .. GENERATED FROM PYTHON SOURCE LINES 60-61 Create the process .. GENERATED FROM PYTHON SOURCE LINES 61-63 .. code-block:: Python process = ot.FunctionalBasisProcess(coefDist, myBasis, myMesh) .. GENERATED FROM PYTHON SOURCE LINES 64-65 Draw a sample .. GENERATED FROM PYTHON SOURCE LINES 65-70 .. code-block:: Python N = 6 sample = process.getSample(N) graph = sample.drawMarginal(0) graph.setTitle(str(N) + " realizations of functional basis process") view = viewer.View(graph) .. image-sg:: /auto_probabilistic_modeling/stochastic_processes/images/sphx_glr_plot_functional_basis_process_001.png :alt: 6 realizations of functional basis process :srcset: /auto_probabilistic_modeling/stochastic_processes/images/sphx_glr_plot_functional_basis_process_001.png :class: sphx-glr-single-img .. _sphx_glr_download_auto_probabilistic_modeling_stochastic_processes_plot_functional_basis_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_functional_basis_process.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_functional_basis_process.py `