Add a trend to a processΒΆ

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

The TrendTransform class enables to create a new process Y from a process X (no hypothesis on X needed):

Y(\omega, t) = X(\omega, t) + f(t)

import openturns as ot
import openturns.viewer as viewer
from matplotlib import pylab as plt


Create a process

grid = ot.RegularGrid(0.0, 0.1, 10)
amplitude = [5.0]
scale = [0.2]
covModel = ot.ExponentialModel(scale, amplitude)
X = ot.GaussianProcess(covModel, grid)

Draw a sample

sample = X.getSample(6)
graph = sample.drawMarginal(0)
view = viewer.View(graph)
X - 0 marginal

Define a trend function

f = ot.SymbolicFunction(["t"], ["30*t"])
fTrend = ot.TrendTransform(f, grid)

Add it to the process

Y = ot.CompositeProcess(fTrend, X)

Draw a sample

sample = Y.getSample(6)
graph = sample.drawMarginal(0)
view = viewer.View(graph)
Y - 0 marginal