How is the output size of UPFIRDN determined?

1 次查看(过去 30 天)
I want to understand resampling better, so I am trying to replicate the functionality of Matlab's built-in upfirdn() function. To clarify, I'm not looking for a fast implementation (at first), I just want to see how to get the exact same result. As such, I understand the basic steps (conceptually) are:
(1) Upsampling by P (zero insertion).
(2) FIR filtering.
(3) Downsampling by Q (throwing away samples).
This is fine. However, what is bugging me is that (as stated by Matlab help) the final output size is:
Ly = ceil( ((Lx-1)*P + Lh)/Q ) where Lx = length(X) and Lh = length(H)
and I don't understand why. With reference to the 3 stages listed above, a naive implementation might give stage-by-stage output sizes:
(1) P*Lx
(2) P*Lx
(3) floor(P*Lx/Q)
Therefore, I really want to know exactly what upfirdn is doing. Can anyone help?
  1 个评论
Bradford Watson
Bradford Watson 2021-1-29
Whenever two sequences are convolved together, the length of the resulting sequence is Lx + Ly - 1. The inner part of this equation is expressing the length of the convolution of the upsampled sequence (Lx-1)*P and the filter length (Lh), though neglecting the -1 term. This is then divided by the decimation, and the ceiling function is taken to get rid of any fraction.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multirate Signal Processing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by