Accelerating the pace of engineering and science

# Documentation Center

• Trial Software

# Ideal Rectangular Pulse Filter

Shape input signal using ideal rectangular pulses

Comm Filters

## Description

The Ideal Rectangular Pulse Filter block upsamples and shapes the input signal using rectangular pulses. The block replicates each input sample N times, where N is the Pulse length parameter. After replicating input samples, the block can also normalize the output signal and/or apply a linear amplitude gain.

If the Pulse delay parameter is nonzero, then the block outputs that number of zeros at the beginning of the simulation, before starting to replicate any of the input values.

This block accepts a scalar, column vector, or matrix input signal. For information about the data types each block port supports, see the Supported Data Type table on this page.

The vector size, the pulse length, and the pulse delay are mutually independent. They do not need to satisfy any conditions with respect to each other.

### Single-Rate Processing

When you set the Rate options parameter to Enforce single-rate processing, the input and output of the block have the same sample rate. To generate the output while maintaining the input sample rate, the block resamples the data in each column of the input such that the frame size of the output (Mo) is L times larger than that of the input (Mo = Mi*L), where L is the Pulse length (number of samples) parameter value.

### Multirate Processing

When you set the Rate options parameter to Allow multirate processing, the input and output of the block are the same size. However, the sample rate of the output is L times faster than that of the input (i.e. the output sample time is 1/N times the input sample time). When the block is in multirate processing mode, you must also specify a value for the Input processing parameter:

• When you set the Input processing parameter to Elements as channels (sample based), the block treats an M-by-N matrix input as M*N independent channels, and processes each channel over time. The output sample period (Tso) is L times shorter than the input sample period (Tso = Tsi/L), while the input and output sizes remain identical.

• When you set the Input processing parameter to Columns as channels (frame based), the block treats an Mi-by-N matrix input as N independent channels. The block processes each column of the input over time by keeping the frame size constant (Mi=Mo), while making the output frame period (Tfo) L times shorter than the input frame period (Tfo = Tfi/L).

### Normalization Methods

You determine the block's normalization behavior using the Normalize output signal and Linear amplitude gain parameters.

• If you clear Normalize output signal, then the block multiplies the set of replicated values by the Linear amplitude gain parameter. This parameter must be a scalar.

• If you select Normalize output signal, then the Normalization method parameter appears. The block scales the set of replicated values so that one of these conditions is true:

• The sum of the samples in each pulse equals the original input value that the block replicated.

• The energy in each pulse equals the energy of the original input value that the block replicated. That is, the sum of the squared samples in each pulse equals the square of the input value.

After the block applies the scaling specified in the Normalization method parameter, it multiplies the scaled signal by the constant scalar value specified in the Linear amplitude gain parameter.

The output is scaled by . If the output of this block feeds the input to the AWGN Channel block, specify the AWGN signal power parameter to be 1/N.

## Dialog Box

Pulse length (number of samples)

The number of samples in each output pulse; that is, the number of times the block replicates each input value when creating the output signal.

Pulse delay (number of samples)

The number of zeros that appear in the output at the beginning of the simulation, before the block replicates any input values.

Input processing

Specify how the block processes the input signal. You can set this parameter to one of the following options:

• Columns as channels (frame based) — When you select this option, the block treats each column of the input as a separate channel.

• Elements as channels (sample based) — When you select this option, the block treats each element of the input as a separate channel.

 Note:   The Inherited (this choice will be removed - see release notes) option will be removed in a future release. See Frame-Based Processing in the Communications System Toolbox™ Release Notes for more information.
Rate options

Specify the method by which the block should upsample and shape the input signal. You can select one of the following options:

• Enforce single-rate processing — When you select this option, the block maintains the input sample rate, and processes the signal by increasing the output frame size by a factor of L. To select this option, you must set the Input processing parameter to Columns as channels (frame based).

• Allow multirate processing — When you select this option, the block processes the signal such that the output sample rate is L times faster than the input sample rate.

Normalize output signal

If you select this, then the block scales the set of replicated values before applying the linear amplitude gain.

Normalization method

The quantity that the block considers when scaling the set of replicated values. Choices are Sum of samples and Energy per pulse. This field appears only if you select Normalize method.

Linear amplitude gain

A positive scalar used to scale the output signal.

Rounding mode

Use this parameter to specify the rounding method to be used when the result of a fixed-point calculation does not map exactly to a number representable by the data type and scaling storing the result. The filter coefficients do not obey this parameter; they always round to Nearest.

For more information, see Rounding Modes in the DSP System Toolbox™ documentation or Rounding Mode: Simplest in the Fixed-Point Designer™ documentation.

Overflow mode

Select the overflow mode for fixed-point operations. The filter coefficients do not obey this parameter; they are always saturated.

Coefficients

Choose how you specify the word length and the fraction length of the filter coefficients (numerator and/or denominator). See Filter Structure Diagrams in DSP System Toolbox Reference Guide for illustrations depicting the use of the coefficient data types in this block:

• When you select Same word length as input, the word length of the filter coefficients match that of the input to the block. In this mode, the fraction length of the coefficients is automatically set to the binary-point only scaling that provides you with the best precision possible given the value and word length of the coefficients.

• When you select Specify word length, you are able to enter the word length of the coefficients, in bits. In this mode, the fraction length of the coefficients is automatically set to the binary-point only scaling that provides you with the best precision possible given the value and word length of the coefficients.

• When you select Binary point scaling, you are able to enter the word length and the fraction length of the coefficients, in bits. If applicable, you are able to enter separate fraction lengths for the numerator and denominator coefficients.

• When you select Slope and bias scaling, you are able to enter the word length, in bits, and the slope of the coefficients. If applicable, you are able to enter separate slopes for the numerator and denominator coefficients. This block requires power-of-two slope and a bias of zero.

• The filter coefficients do not obey the Rounding mode and the Overflow mode parameters; they are always saturated and rounded to Nearest.

Product output

Use this parameter to specify how you would like to designate the product output word and fraction lengths. See Filter Structure Diagrams and Multiplication Data Types in DSP System Toolbox Reference Guide for illustrations depicting the use of the product output data type in this block:

• When you select Same as input, these characteristics match those of the input to the block.

• When you select Binary point scaling, you are able to enter the word length and the fraction length of the product output, in bits.

• When you select Slope and bias scaling, you are able to enter the word length, in bits, and the slope of the product output. This block requires power-of-two slope and a bias of zero.

Accumulator

Use this parameter to specify how you would like to designate the accumulator word and fraction lengths. See Filter Structure Diagrams and Multiplication Data Types for illustrations depicting the use of the accumulator data type in this block:

• When you select Same as input, these characteristics match those of the input to the block.

• When you select Same as product output, these characteristics match those of the product output.

• When you select Binary point scaling, you are able to enter the word length and the fraction length of the accumulator, in bits.

• When you select Slope and bias scaling, you are able to enter the word length, in bits, and the slope of the accumulator. This block requires power-of-two slope and a bias of zero.

Output

Choose how you specify the output word length and fraction length:

• When you select Same as input, these characteristics match those of the input to the block.

• When you select Same as accumulator, these characteristics match those of the accumulator.

• When you select Binary point scaling, you are able to enter the word length and the fraction length of the output, in bits.

• When you select Slope and bias scaling, you are able to enter the word length, in bits, and the slope of the output. This block requires power-of-two slope and a bias of zero.

Lock scaling against changes by the autoscaling tool

Select this check box to prevent any fixed-point scaling you specify in the block mask from being overridden by the autoscaling tool in the Fixed-Point Tool.

## Supported Data Type

PortSupported Data Types
In
• Double-precision floating point

• Single-precision floating point

• Fixed-point

Out
• Double-precision floating point

• Single-precision floating point

• Signed fixed-point

## Examples

If Pulse length is 4 and Pulse delay is the scalar 3, then the table below shows how the block treats the beginning of a ramp (1, 2, 3,...) in several situations. (The values shown in the table do not reflect vector sizes but merely indicate numerical values.)

Normalization Method, If AnyLinear Amplitude GainFirst Several Output Values
None (Normalize output signal cleared) 10, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,...
None (Normalize output signal cleared) 100, 0, 0, 10, 10, 10, 10, 20, 20, 20, 20, 30, 30, 30, 30,...
Sum of samples10, 0, 0, 0.25, 0.25, 0.25, 0.25, 0.5, 0.5, 0.5, 0.5, 0.75, 0.75, 0.75, 0.75,..., where 0.25*4=1
Sum of samples100, 0, 0, 2.5, 2.5, 2.5, 2.5, 5, 5, 5, 5, 7.5, 7.5, 7.5, 7.5,...
Energy per pulse10, 0, 0, 0.5, 0.5, 0.5, 0.5, 1.0, 1.0, 1.0, 1.0, 1.5, 1.5, 1.5, 1.5,..., where (0.5)^2*4=1^2
Energy per pulse100, 0, 0, 5, 5, 5, 5, 10, 10, 10, 10, 15, 15, 15, 15,...