Ideal Rectangular Pulse Filter
Shape input signal using ideal rectangular pulses
Libraries:
Communications Toolbox /
Comm Filters
Description
The Ideal Rectangular Pulse Filter block upsamples and shapes the input signal using rectangular pulses. After replicating input samples, the block can also normalize the output signal and apply a linear amplitude gain.
Examples
Apply Rectangular Filter to Ramp Input in Simulink
Apply ideal rectangular filtering to a ramp signal.
The cm_ideal_rect_pulse_filter
model plots a ramp signal with various normalization methods applied. The model includes three Ideal Rectangular Pulse Filter blocks configured with Pulse length (number of samples) set to 4
and Pulse delay (number of samples) set to 3
to filter a ramp input signal, and an Array Plot block with default settings to display one frame of the output signals.
Run the model with Linear amplitude gain of the filters set to 1
. The first three samples are zero because the filter blocks have pulse delay set to 3
.
Run the model with Linear amplitude gain of filters set to 10
.
Ports
Input
In — Input signal
scalar  column vector  matrix
Input signal, specified as a scalar, column vector, or K_{i}byN matrix. K_{i} is the number of input samples per signal channel, and N is the number of signal channels.
Data Types: double
 single
 fixed point
Output
Out — Output signal
column vector  matrix
Output signal, returned as a scalar, column vector, or matrix. The block filters each channel over time and generates a K_{o}byN output matrix. The output signal is the same data type as the input signal.
K_{o} = K_{i} × L.
N is the number of signal channels.
K_{i} is the number of input samples per signal channel.
L is the value you specify in the Pulse length (number of samples) parameter.
Data Types: double
 single
 fixed point
Parameters
To edit block parameters interactively, use the Property Inspector. From the Simulink^{®} Toolstrip, on the Simulation tab, in the Prepare gallery, select Property Inspector.
MainPulse length (number of samples) — Pulse length
8
(default)  positive integer
Pulse length in samples, specified as a positive integer. The block replicates each input sample L times, where L is the pulse length that you specify in samples.
Pulse delay (number of samples) — Pulse delay
0
(default)  nonnegative integer
Pulse delay in samples, specified as a nonnegative integer. If this 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.
Input processing — Input processing control
Columns as channels (frame based)
(default)  Elements as channels (sample based)
Input processing control, specified as one of these options:
Columns as channels (frame based)
— The block treats each column of the input as a separate channel.Elements as channels (sample based)
— The block treats each element of the input as a separate channel.
Rate options — Block processing rate
Enforce singlerate processing
(default)  Allow multirate processing
Block processing rate for input signal upsampling and filtering, specified as one of these options:
Enforce singlerate 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 N.Allow multirate processing
— When you select this option, the block processes the signal such that the output sample rate is N times faster than the input sample rate.
Dependencies
To use Enforce singlerate processing
, you must set
Input processing to Columns as channels
(frame based)
.
Normalize output signal — Option to normalize output signal
off
(default)  on
Select this parameter to scale the set of replicated values before applying the linear amplitude gain.
Normalization method — Normalization method
Sum of samples
(default)  Energy per pulse
Normalization method, specified as Sum of samples
or
Energy per pulse
. This parameter assigns the
quantity that the block considers when scaling the set of replicated values.
For more information, see Normalization Methods.
Dependencies
This parameter appears when you select Normalize output signal.
Linear amplitude gain — Linear gain
1
(default)  positive scalar
Linear gain, specified as a positive scalar. The block scales the output signal by the linear gain value that you specify. For more information, see Normalization Methods.
Rounding mode — Rounding mode for fixedpoint operations
Floor
(default)  Ceiling
 Convergent
 Nearest
 Round
 Simplest
 Zero
Select the rounding mode for fixedpoint operations. The block uses
rounding mode when the result of a fixedpoint calculation does not map
exactly to a number representable by the data type. The filter coefficients
do not obey this parameter; they always round to
Nearest
. For more information, see Rounding Modes
or Rounding Mode: Simplest (FixedPoint Designer).
Saturate on integer overflow — Overflow mode for fixedpoint operations
off
(default)  on
Select the overflow mode for fixedpoint operations. The filter coefficients do not obey this parameter; they are always saturated.
Coefficients — Coefficient data type
Inherit: Same word length as
input
(default)  fixdt(1,16)
 fixdt(1,16,0)
Specify the word length and the fraction length of the filter coefficients (numerator and denominator). For illustrations depicting the use of the coefficient data types in this block, see Filter Structure Diagrams.
When you select Inherit: 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 binarypointonly scaling that provides you with the best precision
possible given the value and word length of the coefficients.
The filter coefficients do not obey the Rounding
mode and the Saturate
on integer overflow parameters; they are always saturated
and rounded to Nearest
.
For information about specifying data types, see Data Type Assistant.
Product output — Product output data type
Inherit: Inherit via internal
rule
(default)  Inherit: Same as input
 fixdt(1,16,0)
Specify the product output word and fraction lengths. For diagrams showing the use of the product output data type in this block, see the filter structure diagrams for the Discrete FIR Filter (Simulink) block and Multiplication Data Types.
When you select
Inherit: Inherit via internal rule
, the block inherits the data type based on an internal rule. For more information on this rule, see Inherit via Internal Rule.When you select
Inherit: Same as input
, these characteristics match those of the input to the block.
For information about specifying data types, see Data Type Assistant.
Accumulator — Accumulator data type
Inherit via internal
rule
(default)  Inherit: Same as input
 Inherit: Same as product output
 fixdt(1,16,0)
Specify the accumulator word and fraction lengths. For diagrams showing the use of the accumulator output data type in this block, see the filter structure diagrams for the Discrete FIR Filter (Simulink) block and Multiplication Data Types.
When you select
Inherit via internal rule
, the block inherits the data type based on an internal rule. For more information on this rule, see Inherit via Internal Rule.When you select
Inherit: Same as input
, these characteristics match those of the input to the block.When you select
Inherit: Same as product output
, these characteristics match those of the product output.
For information about specifying data types, see Data Type Assistant.
Output — Output data type
Inherit: Same as
accumulator
(default)  Inherit: Same as input
 Inherit: Same as product output
 fixdt(1,16,0)
Specify the output word and fraction lengths.
When you select
Inherit: Same as input
, these characteristics match those of the input to the block.When you select
Inherit: Same as accumulator
, these characteristics match those of the accumulator.When you select
Inherit: Same as product output
, these characteristics match those of the product output.
For information about specifying data types, see Data Type Assistant.
Lock data type settings against changes by the fixedpoint tools — Prevent fixedpoint tools from overriding data types
off
(default)  on
Select this parameter to prevent the fixedpoint tools from overriding the data types that you specify in the block dialog box. For more information, see the FixedPoint Tool (FixedPoint Designer).
Block Characteristics
Data Types 

Multidimensional Signals 

VariableSize Signals 

^{a} Fixedpoint outputs must be signed. 
More About
Data Type Assistant
The Data Type Assistant helps you set data attributes. To use the Data Type Assistant, click Show data type assistant . For more information, see Specify Data Types Using Data Type Assistant (Simulink).
Algorithms
SingleRate Processing
When you set the Rate
options parameter to Enforce singlerate
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 (M_{Out}) is L
times larger than that of the input (M_{O} =
M_{I}×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 and the output sample time is 1 / L times the
input sample time, where L is the Pulse length
(number of samples) parameter value. 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 MbyN matrix input as (M×N) independent channels, and processes each channel over time. The output sample period, T_{S_Out}, is L times shorter than the input sample period (T_{S_Out} = T_{S_In} / 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 M_{In}byN matrix input as N independent channels. The block processes each column of the input over time by keeping the frame size constant (M_{In}=M_{Out}), while making the output frame period, T_{F_Out}, L times shorter than the input frame period (T_{F_Out} = T_{F_In} / L).
Normalization Methods
You configure the normalization behavior of the block by 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:
When you set the Normalization method parameter to
Sum of samples
, the sum of the samples in each pulse equals the original input value that the block replicated. Effectively, the block uses a rectangular pulse with amplitude of (1 / L), where L is the pulse length.When you set the Normalization method parameter to
Energy per pulse
, the sum of the squared samples in each pulse equals the square of the input value. Effectively, the block uses a rectangular pulse with amplitude of (1 / √L), where L is the pulse length.
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.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced before R2006a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
 América Latina (Español)
 Canada (English)
 United States (English)
Europe
 Belgium (English)
 Denmark (English)
 Deutschland (Deutsch)
 España (Español)
 Finland (English)
 France (Français)
 Ireland (English)
 Italia (Italiano)
 Luxembourg (English)
 Netherlands (English)
 Norway (English)
 Österreich (Deutsch)
 Portugal (English)
 Sweden (English)
 Switzerland
 United Kingdom (English)