.. 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_parametric_spectral_density.py: Create a parametric spectral density function ============================================= This example illustrates how the User can create a density spectral function from parametric models. The library implements the *Cauchy spectral model* as a parametric model for the spectral density function :math:`S`. The library defines this model thanks to the object *CauchyModel*. .. code-block:: default from __future__ import print_function import openturns as ot import openturns.viewer as viewer from matplotlib import pylab as plt ot.Log.Show(ot.Log.NONE) 1. Define a spectral density function from correlation matrix .. code-block:: default amplitude = [1.0, 2.0, 3.0] scale = [4.0, 5.0, 6.0] spatialCorrelation = ot.CorrelationMatrix(3) spatialCorrelation[0, 1] = 0.8 spatialCorrelation[0, 2] = 0.6 spatialCorrelation[1, 2] = 0.1 spectralModel_Corr = ot.CauchyModel(amplitude, scale, spatialCorrelation) spectralModel_Corr .. raw:: html

class=CauchyModel amplitude=[4,5,6] scale=[1,2,3] spatial correlation=
[[ 1 0.8 0.6 ]
[ 0.8 1 0.1 ]
[ 0.6 0.1 1 ]]



2. Define a spectral density function from a covariance matrix .. code-block:: default spatialCovariance = ot.CovarianceMatrix(3) spatialCovariance[0, 0] = 4.0 spatialCovariance[1, 1] = 5.0 spatialCovariance[2, 2] = 6.0 spatialCovariance[0, 1] = 1.2 spatialCovariance[0, 2] = 0.9 spatialCovariance[1, 2] = -0.2 spectralModel_Cov = ot.CauchyModel(scale, spatialCovariance) spectralModel_Cov .. raw:: html

class=CauchyModel amplitude=[2,2.23607,2.44949] scale=[4,5,6] spatial correlation=
[[ 1 0.268328 0.183712 ]
[ 0.268328 1 -0.0365148 ]
[ 0.183712 -0.0365148 1 ]]



.. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.002 seconds) .. _sphx_glr_download_auto_probabilistic_modeling_stochastic_processes_plot_parametric_spectral_density.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_parametric_spectral_density.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_parametric_spectral_density.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_