DSP Blockset |
 |
Zero Pad
Alter the input size by zero-padding or truncating rows and/or columns.
Library
Signal Operations
Description

The Zero Pad block changes the size of the input matrix from Mi-by-Ni to Mo-by-No by zero-padding or truncating along the rows, the columns, or both dimensions. The dimensions of the output, Mo and No, are specified by the Number of output rows and Number of output columns parameters, respectively. You can set Action when truncation occurs so that the block gives a warning or an error when truncation occurs.
The Zero pad along parameter specifies how the input should be altered. The options are:
- When Columns is selected, the Number of output rows parameter (Mo) is enabled, and the block pads or truncates each input column by an equal amount. If Mo>Mi, the block pads by adding Mo-Mi rows of zeros to the bottom of the matrix. If Mo<Mi, the block truncates by deleting Mi-Mo rows from the bottom of the matrix. In both cases, the number of columns is unchanged (No=Ni). A 1-D vector input is zero padded or truncated at the "bottom," and the output is a 1-D vector.
- When Rows is selected, the Number of output columns parameter (No) is enabled, and the block pads or truncates each input row by an equal amount. If No>Ni, the block pads by adding No-Ni columns of zeros to the right side of the matrix. If No<Ni, the block truncates by deleting Ni-No columns from the right side of the matrix. In both cases, the number of rows is unchanged (Mo=Mi). A 1-D vector input is zero padded or truncated at the "bottom," and the output is a 1-D vector.
- When Columns and rows is selected, both the Number of output rows parameter (Mo) and the Number of output columns parameter (No) are enabled, and the block pads or truncates rows and columns as specified. A length-Mi 1-D vector input is treated as an Mi-by-1 matrix and the output is an Mo-by-No matrix.
- When None is selected, the input is passed through to the output without padding or truncation.
Example
In the model below, the 3-by-3 input is zero-padded along the column dimension to 5-by-3. The parameter settings in the Zero Pad block are:
- Zero pad along = Columns
- Number of output rows =
5

Dialog Box

- Zero pad along
- The direction along which to pad or truncate. Columns specifies that the row dimension should be changed to Mo; Rows specifies that the column dimension should be changed to No; Columns and rows specifies that both column and row dimensions should be changed; None disables padding and truncation and passes the input through to the output unchanged.
- Number of output rows
- The desired number of rows in the output, Mo. This parameter is enabled when Columns or Columns and rows is selected in the Zero pad along menu.
- Number of output columns
- The desired number of columns in the output, No. This parameter is enabled when Rows or Columns and rows is selected in the Zero pad along menu.
- Action When Truncation Occurs
- The block's behavior when the input matrix is truncated. It gives a Warning, an Error, or gives no indication of the truncation when set to None.
Supported Data Types
- Double-precision floating point
- Single-precision floating point
- Fixed-point
- Custom data types
- Boolean
- 8-, 16-, and 32-bit signed integers
- 8-, 16-, and 32-bit unsigned integers
To learn how to convert to the above data types in MATLAB and Simulink, see Supported Data Types and How to Convert to Them.
See Also
Also see Signal Operations for a list of all the blocks in the Signal Operations library.
| Yule-Walker Method | | Function Reference |  |