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 view (last 30 days)
Show older comments
Sai Prakash Reddy Konda
on 8 Sep 2018
Commented: Sai Prakash Reddy Konda
on 3 Oct 2018
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.
0 Comments
Accepted Answer
Image Analyst
on 8 Sep 2018
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.
2 Comments
More Answers (1)
Walter Roberson
on 8 Sep 2018
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
See Also
Categories
Find more on Filter Design in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!