Main Content

# Constant Ramp

Generate ramp signal with length based on input dimensions

Libraries:
DSP System Toolbox / Signal Operations

## Description

The Constant Ramp block generates the constant ramp signal

y = (0:L-1)*m + b

where m is the slope specified by the scalar Slope parameter, and b is the y-intercept specified by the scalar Offset parameter.

For an unoriented vector input, L is equal to the length of the input vector. For an N-D input array, the length L of the output ramp is equal to the length of the input in the dimension specified by the Ramp length equals number of or Dimension parameter. The output, y, is always an unoriented vector.

## Examples

expand all

Generate a ramp signal using the Constant Ramp block. The Ramp length equals number of parameter allows you to specify input signal dimension that determines the length of the generated constant ramp signal.

For N-D input signals, set the Ramp length equals number of parameter to Elements in specified dimension. Then specify the desired dimension using the Dimension parameter.

## Ports

### Input

expand all

Input signal used to generate ramp signal, specified as a scalar, vector, matrix, or N-D array.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | Boolean | fixed point

### Output

expand all

Output signal, specified as an unoriented vector. The block determines the length of the output based on the length of the input signal, and the Ramp length equals number of or Dimension parameter.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | Boolean | fixed point

## Parameters

expand all

### Main

Specify whether the length of the output ramp is the number of rows, number of columns, or the length of the specified dimension of the input.

Specify the one-based dimension of the input array that determines the length of the output ramp as a positive integer scalar.

#### Dependencies

To enable this parameter, set Ramp length equals number of to Elements in specified dimension.

Specify the slope of the ramp as a real-valued double-precision scalar.

Specify the scalar y-intercept of the ramp as a real-valued double-precision scalar.

### Data Types

Specify the output data type for this block. You can select one of the following:

• A rule that inherits a data type, for example, Inherit: Same as input.

• A built-in data type, such as double

• An expression that evaluates to a valid data type, for example, fixdt(1,16)

For help setting data type parameters, display the Data Type Assistant by clicking the button .

See Control Data Types of Signals (Simulink) for more information.

### Data Type Assistant Parameters

Select how you would like to specify the data type properties of the Output data type. You can choose:

• Inherit — Lets you specify a rule for inheriting a data type, for example, Inherit: Same as input

• Built in— Lets you specify a built-in data type, for example, double

• Fixed point — Lets you specify the fixed-point attributes of the data type.

• Expression — Lets you specify an expression that evaluates to a valid data type, for example, fixdt(1,16)

For more information, see Specify Data Types Using Data Type Assistant (Simulink).

Specify whether the fixed-point data is signed or unsigned. Signed data can represent positive and negative values, but Unsigned data represents positive values only. For more information, see Specify Data Types Using Data Type Assistant (Simulink).

Specify the bit size of the word that holds the quantized integer as an integer scalar from 2 to 128. For more information, see Specify Data Types Using Data Type Assistant (Simulink).

#### Dependencies

To enable this parameter, set Mode to Fixed point

Specify the method for scaling your fixed-point data to avoid overflow conditions and minimize quantization errors. For more information, see Specify Data Types Using Data Type Assistant (Simulink).

#### Dependencies

To enable this parameter, set Mode to Fixed point

Select the data type override mode for this signal. You can select:

• Inherit — Inherits the data type override setting specified for the model.

• Off — Ignores the data type override setting specified for the model and uses the fixed-point data type you specify.

#### Dependencies

To enable this parameter, set Mode to Built in or Fixed point. For more information, see Specify Data Types Using Data Type Assistant (Simulink).

Specify the fraction length of the fixed-point data type as a positive or negative integer scalar.

#### Dependencies

To enable this parameter, set Mode to Fixed point and Scaling to Binary point.

## Block Characteristics

 Data Types double | fixed point | integer | single Direct Feedthrough no Multidimensional Signals no Variable-Size Signals no Zero-Crossing Detection no

## Version History

Introduced before R2006a