What indices of the original sequence are retained in the output of the decimate function?

조회 수: 1 (최근 30일)
I am using the decimate function y = decimate(x,r) and I need to know to which index in x the value y(i) corresponds.
This is not explicitly addressed in the documentation. In the first example the number of points is k*r+1 and according to the code it seems y(1) corresponds to index 1 in x, while and y(length(y)) correponds to index length(x) in x.
In the second example of the documentation, where length(x) is not of the form k*r+1, it seems y(length(y)) corresponds to the last index of the original vector x.
Is that always the case? Would that depend on the type of filter applied (e.g. Chebyshev vs FIR) ?
Thanks for any input on the matter.
Regards.
G. Garcia
For convenience, here is the second example of the documentation:
r = 13;
n = 16:365;
lx = length(n);
x = sin(2*pi*n/153) + cos(2*pi*n/127);
plot(0:lx-1,x,'o')
hold on
y = decimate(x,r,5);
stem(lx-1:-r:0,fliplr(y),'ro','filled','markersize',4)
legend('Original','Decimated','Location','south')
xlabel('Sample number')
ylabel('Signal')
And the associated graph, showing correspondance between last element of x and last element of y:

채택된 답변

Voss
Voss 2022년 11월 29일
From item #3 in the Algorithms section of the documentation for decimate:
"In the resampled sequence (y), y(end) matches x(end) when the IIR filter is used, and y(1) matches x(1) when the FIR filter is used."
  댓글 수: 3
Voss
Voss 2022년 11월 29일
By default, decimate uses a lowpass Chebyshev Type I infinite impulse response (IIR) filter of order 8.
Gaëtan Garcia
Gaëtan Garcia 2022년 11월 29일
Okay, now I get it. I did not know that the Chebyshev filter was an IIR filter, so I thought the information in the documentation was incomplete. Now to be honest, I should have realized that a filter was either FIR or IIR...
Now I really have all I need. Thank you again for being patient enough to connect the dots...
Regards.
G. Garcia

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Digital and Analog Filters에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by