# Creation of a regular grid¶

In this example we will demonstrate how to create a regular grid. Note that a regular grid is a particular mesh of .

Here we will assume it represents the time as it is often the case, but it can represent any physical quantity.

A regular time grid is a regular discretization of the interval into points, noted .

The time grid can be defined using where is the number of points in the time grid. the time step between two consecutive instants and . Then, and .

Consider a multivariate stochastic process of dimension , where , and is interpreted as a time stamp. Then the mesh associated to the process is a (regular) time grid.

:

from __future__ import print_function
import openturns as ot
import math as m

:

tMin = 0.
tStep = 0.1
n = 10

# Create the grid
time_grid = ot.RegularGrid(tMin, tStep, n)

:

# Get the first and the last instants,
# the step and the number of points
start = time_grid.getStart()
step = time_grid.getStep()
grid_size = time_grid.getN()
end = time_grid.getEnd()
print('start=', start, 'step=', step, 'grid_size=', grid_size, 'end=', end)

start= 0.0 step= 0.1 grid_size= 10 end= 1.0

:

# draw the grid
time_grid.setName('time')
time_grid.draw()

: 