DSP Blockset | ![]() ![]() |
Compute the element-to-element difference along rows or columns.
Library
Math Functions / Math Operations
Description
The Difference block computes the difference between adjacent elements in rows or columns of the M-by-N input matrix u
.
Columnwise Differencing
When the Difference along parameter is set to Columns, the block computes differences between adjacent column elements.
For sample-based inputs, the output is a sample-based (M-1)-by-N matrix whose jth column has elements
For convenience, length-M 1-D vector inputs are treated as M-by-1 column vectors for columnwise differencing, and the output is 1-D.
For frame-based inputs, the output is a frame-based M-by-N matrix whose jth column has elements
The first row of the first output contains the difference between the first row of the first input and zero. The first row of each subsequent output contains the difference between the first row of the current input (time t) and the last row of the previous input (time t-Tf).
Rowwise Differencing
When the Difference along parameter is set to Rows, the block computes differences between adjacent row elements.
The output is an M-by-(N-1) matrix whose ith row has elements
The frame status of the output is the same as the input. For convenience, length-N 1-D vector inputs are treated as 1-by-N row vectors for rowwise differencing, and the output is 1-D.
Dialog Box
Supported Data Types
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
Cumulative Sum |
DSP Blockset |
diff |
MATLAB |
Also see Math Operations for a list of all the blocks in the Math Operations library.
![]() | Detrend | Digital Filter | ![]() |