# Repeating Sequence

Generate arbitrarily shaped periodic signal

Sources

## Description

The Repeating Sequence block outputs a periodic scalar signal having a waveform that you specify using the Time values and Output values parameters. The Time values parameter specifies a vector of output times. The Output values parameter specifies a vector of signal amplitudes at the corresponding output times. Together, the two parameters specify a sampling of the output waveform at points measured from the beginning of the interval over which the waveform repeats (the period of the signal).

By default, both parameters are `[0 2]`. These default settings specify a sawtooth waveform that repeats every `2` seconds from the start of the simulation and has a maximum amplitude of `2`.

## Algorithm

The block sets the input period as the difference between the first and last value of the Time values parameter. The output at any time `t` is the output at time ```t = t-n*period```, where `n` is an integer. The sequence repeats at `t = n*period`. The block uses linear interpolation to compute the value of the waveform between the output times that you specify.

In the following model, the Repeating Sequence block defines Time values as [0:0.1:0.5] and Output values as [0 15 25 09 13 17]. The stop time of the simulation is 0.7 second.

For the Repeating Sequence block:

• The input period is 0.5.

• The output at any time `t` is the output at time `t = t-0.5n`, where `n` = 0, 1, 2, and so on.

• The sequence repeats at `t = 0.5n`, where `n` = 0, 1, 2, and so on.

When you run the model, you get the following results:

At t = 0.5, the expected output is equal to the output at t = 0, which is 0. Therefore, the last value in the Output values vector [0 15 25 09 13 17] does not appear.

## Data Type Support

The Repeating Sequence block outputs real signals of type `double`.

## Parameters

Time values

Specify a vector of strictly monotonically increasing time values. The default is `[0 2]`.

Output values

Specify a vector of output values. Each element corresponds to the time value in the same column. The default is `[0 2]`.

## Examples

The following Simulink examples show how to use the Repeating Sequence block:

• `sldemo_fuelsys`

• `sldemo_hydrod`

• `sldemo_VariableTransportDelay`

## Characteristics

 Data Types Double Sample Time Continuous Multidimensional Signals No Variable-Size Signals No Zero-Crossing Detection No Code Generation Yes