I implemented a polyphase filter function for interpolating and decimating. It works great (I compared it to what I'd get by interp/decim by inserting L-1 zeros and I get the same results) except for when I compensate delay.
I mean, what I'm doing basically is pulse-shaping with a
b=rcosdesign(0.35,4,3,'sqrt'); matlab built-in function (13 taps, so delay is 6). Then I proceed as follows:
Upsample by M=3 then
x=filter(b.*M,1,upsampled_data). After that, I filter again
r=filter(b,1,x) and then I downsample
downsample(r(mean(grpdelay(b))*2+1:end),M). As you can see, I'm removing the delay generetad by both filters.
I have my custom function so in two lines I run:
x_p = polyfilter( data, b.*M, M, 'interpolation' );
rd_p= polyfilter( x_p(mean(grpdelay(b))*2+1:end), b, M, 'decimation' );
When I'm not taking the delay into account, both non-polyphase and polyphase filters output the exact same thing. I kind of understand that I'm not removing the delay at the exact same part of the process in both cases, because I'm removing it right before removing L-1 zeros but after filtering in the non-polyphase case, and in polyphase case I'm removing the delay right before filtering, and I think the correct one is the non-polyphase one but I'm not too sure when I should remove the delay in the polyphase case.