Trying to undertsand how MATLAB does resampling, looking at toolbox/signal/resample.m
.
This is the part where (downsampling) filter coefficients are calculated:
fc = 1/2/pqmax;
L = 2*N*pqmax + 1;
h = firls( L-1, [0 2*fc 2*fc 1], [1 1 0 0]).*kaiser(L,bta)' ;
h = p*h/sum(h);
(In this case pqmax
and p
both represent downsampling ratio.)
Not sure what is the purpose of last line where all filter coefficients are scaled by downsampling ratio over coeffs sum, p/sum(h)
? Does anyone know the theory behind?
MATLAB firls
MATLAB kaiser
firls
theory: Least Squared Error Design of FIR Filters