Add a trend to a processΒΆ

In this basic example we are going to add a trend to a process.

In [5]:
from __future__ import print_function
import openturns as ot
import math as m
In [6]:
# Create a process
myGrid = ot.RegularGrid(0.0, 0.1, 10)
amplitude=[5.0]
scale=[0.2]
myCovModel=ot.ExponentialModel(scale, amplitude)
process = ot.GaussianProcess(myCovModel, myGrid)
In [7]:
# Draw a sample
sample = process.getSample(6)
sample.drawMarginal(0)
Out[7]:
../../_images/examples_probabilistic_modeling_trend_transform_4_0.png
In [8]:
# Define a trend function
f = ot.SymbolicFunction(['t'], ['30*t'])
fTrend = ot.TrendTransform(f, myGrid)
In [9]:
# Add it to the process
transformed_process = ot.CompositeProcess(fTrend, process)
In [10]:
# Draw a sample
sample = transformed_process.getSample(6)
sample.drawMarginal(0)
Out[10]:
../../_images/examples_probabilistic_modeling_trend_transform_7_0.png