| DSP Blockset | ![]() |
Scale the rows or columns of a matrix by a specified vector.
Library
Math Functions / Matrices and Linear Algebra / Matrix Operations
Description
The Matrix Scaling block scales the rows or columns of the M-by-N input matrix A by the values in input vector D.
When the Mode parameter is set to Scale Rows (D*A), input D can be a 1-D or 2-D vector of length M, and the block multiplies each element of D across the corresponding row of matrix A.
This is equivalent to premultiplying A by a diagonal matrix with diagonal D.
y = diag(D)*A % Equivalent MATLAB code
When the Mode parameter is set to Scale Columns (A*D), input D can be a 1-D or 2-D vector of length N, and the block multiplies each element of D across the corresponding column of matrix A.
This is equivalent to postmultiplying A by a diagonal matrix with diagonal D.
y = A*diag(D) % Equivalent MATLAB code
The output is the same size as the input matrix, A. If both inputs are sample-based, the output is sample-based; otherwise, the output is frame-based.
Dialog Box
See Also
| Matrix Multiply |
DSP Blockset |
| Matrix Product |
DSP Blockset |
| Matrix Sum |
DSP Blockset |
| Matrix Product | Matrix Square | ![]() |