Y = filter2(H,X,shape)returns a subsection of the filtered data according toshape. For example,Y = filter2(H,X,'valid')returns only filtered data computed without zero-padded edges.
H—Coefficients of rational transfer function matrix
Coefficients of the rational transfer function, specified as a matrix.
Data Types:double|single|int8|int16|int32|int64|uint8|uint16|uint32|uint64|logical Complex Number Support:Yes
X—Input data matrix
Input data, specified as a matrix. If one or both ofXandHare of typesingle, then the output is also of typesingle. Otherwise,filter2returns typedouble.
Data Types:double|single|int8|int16|int32|int64|uint8|uint16|uint32|uint64|logical Complex Number Support:Yes
shape—Subsection of filtered data 'same'(default) |'full'|'valid'
Subsection of the filtered data, specified as one of these values:
'same'— Return the central part of the filtered data, which is the same size asX.
'full'— Return the full 2-D filtered data.
'valid'— Return only parts of the filtered data that are computed without zero-padded edges.
Algorithms
Thefilter2function filters data by taking the 2-D convolution of the inputXand the coefficient matrixHrotated 180 degrees. Specifically,filter2(H,X,shape)相当于conv2(X,rot90(H,2),shape).
Extended Capabilities
C/C++ Code Generation Generate C and C++ code using MATLAB® Coder™.
Thread-Based Environment Run code in the background using MATLAB®backgroundPoolor accelerate code with Parallel Computing Toolbox™ThreadPool.
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.