Hi, I have a matrix 1664 × 128. How to design a filter, the output of the filter is 832×128. That is, it should have first half of 1664(i.e. 832) and should remove other part. I know that I can use: (1:832,:). But I want to design a filter for it.

1 次查看(过去 30 天)
Hi, I have a matrix 1664 × 128. How to design a filter, the output of the filter is 832×128. That is, it should have first half of 1664(i.e. 832) and should remove other part. I know that I can use: (1:832,:). But I want to design a filter for it.

采纳的回答

Image Analyst
Image Analyst 2018-9-8
Not sure what you want. Do you want a filter that returns the matrix unaffected on the top half and the bottom half is all zeros, or cropped off entirely? Or something else?
To zero:
function filteredM = MyFilter(M)
filteredM = M; % Initialize
filteredM(833:end, :) = 0
To crop
function filteredM = MyFilter(M)
filteredM = M(1:832, :);
If that's not what you mean, then explain better.

更多回答(1 个)

Walter Roberson
Walter Roberson 2018-9-8
Filters always return an output the same size as the input, so this is not something that can be done as a true filter.
It can be done as an anonymous function
F = @(M) M(1:floor(end/2),:);
In the case of a matrix with an odd number of rows this does not copy the center row. If you want the center row copied then use ceil instead of floor

类别

Help CenterFile Exchange 中查找有关 Filter Design 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by