How is the output size of UPFIRDN determined?
4 views (last 30 days)
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:
Therefore, I really want to know exactly what upfirdn is doing. Can anyone help?