Main Content

Repeating Sequence

Generate arbitrarily shaped periodic signal

  • Repeating Sequence block

Libraries:
Simulink / 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.

Examples

expand all

This example shows how you specify a waveform with the Repeating Sequence block. In this model, the block defines the Time values parameter as [0:0.1:0.5] and the Output values parameter as [0 15 25 09 13 17]. The stop time of the simulation is 0.7 second.

  • Input period is 0.5.

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

  • Sequence repeats at t = 0.5n.

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 parameter vector [0 15 25 09 13 17] does not appear.

Ports

Output

expand all

Output signal specified by the Time values and Output values parameters to create a periodic scalar signal.

Data Types: double

Parameters

expand all

Vector of strictly monotonically increasing time values. The period of the generated waveform is the difference of the last and first values of this parameter.

Programmatic Use

Block Parameter: rep_seq_t
Type: character vector
Values: vector
Default: [0 2]

Vector of output values that specify the output waveform. Each element corresponds to the time value in the Time valuesparameter.

Programmatic Use

Block Parameter: rep_seq_y
Type: character vector
Values: vector
Default: [0 2]

Block Characteristics

Data Types

double

Direct Feedthrough

no

Multidimensional Signals

no

Variable-Size Signals

no

Zero-Crossing Detection

no

Algorithms

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.

Extended Capabilities

Version History

Introduced before R2006a