Documentation

# unigrid

## Syntax

```Grid = unigrid(StartValue,Step,EndValue) Grid = unigrid(StartValue,Step,EndValue,IntervalType) ```

## Description

`Grid = unigrid(StartValue,Step,EndValue)` returns a uniformly sampled grid from the closed interval `[StartValue,EndValue]`, starting from `StartValue`. `Step` specifies the step size. This syntax is the same as calling `StartValue:Step:EndValue`.

`Grid = unigrid(StartValue,Step,EndValue,IntervalType)` specifies whether the interval is closed, or semi-open. Valid values of `IntervalType` are `'[]'` (default), and `'[)'`. Specifying a closed interval does not always cause `Grid` to contain the value `EndValue`. The inclusion of `EndValue` in a closed interval also depends on the step size `Step`.

## Examples

collapse all

Create a uniform closed interval grid with a positive increment.

```grid = unigrid(0,0.1,1); grid(1)```
```ans = 0 ```
`grid(end)`
```ans = 1 ```

Note that `grid(1) = 0` and `grid(end) = 1`.

Create a uniform grid with a semi-open interval.

```grid = unigrid(0,0.1,1,'[)'); grid(1)```
```ans = 0 ```
`grid(end)`
```ans = 0.9000 ```

In this case, `grid(end) = 0.9`

Create a decreasing grid with a semi-open interval.

`grid = unigrid(1,-0.2,0,'[)')`
```grid = 1×5 1.0000 0.8000 0.6000 0.4000 0.2000 ```