downsample fuction error, I want to know how to design the downsampling filter
이전 댓글 표시
x = [1 2 3 4 5 6 7 8 9 10];
y = downsample(x,3)
y =
9 27 45 63 81
I want to know how to design the downsampling filter. I run the code on matlab2015b and the answer is wrong. so I consult the downsampling function. but I don't know how to design the filter. the following is the code of the downsample function provided by matlab:
% Downsampling procedure.
%
% Arguments:
% grayscale I image
% downsampling filter 'filter', should be a 1D separable filter.
% 'border_mode' should be 'circular', 'symmetric', or 'replicate'. See 'imfilter'.
%
% If image width W is odd, then the resulting image will have width (W-1)/2+1,
% Same for height.
%
% tom.mertens@gmail.com, August 2007
%
function R = downsample(I, filter)
border_mode = 'symmetric';
% low pass, convolve with separable filter
R = imfilter(I,filter,border_mode); %horizontal
R = imfilter(R,filter',border_mode); %vertical
% decimate
r = size(I,1);
c = size(I,2);
R = R(1:2:r, 1:2:c, :);
답변 (1개)
Honglei Chen
2015년 11월 23일
0 개 추천
This is a third party program and is not provided by MathWorks. I don't know what your goal is but the function is doing what exactly it's asked to do. From the comment, the function is meant to be used with an image, not a 1D signal. HTH
카테고리
도움말 센터 및 File Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!