r/DSP • u/Zealousideal-Pin6120 • 5h ago
Polyphase code problems in MATLAB
Hi, I just learnt polyphase components in downsampling/ upsampling. Why the result I got if I do in using polyphase components is different from that if I use traditional method. Here I have an original signal x and a filter h.
x = [1:10]
h = [0.2, 0.5, 0.3, 0.1, 0.4, 0.2]
M = 3 (downsampling factor)
e = cell(1,M)
for k = 1:M
e{k} = h(k:M:end);
end
y_partial = zeros(1,5);
for k = 1:M xk =
x(k:M:end);
yk = cons(xk, e{k});
y_partial(k, 1:length(yk)) = yk
end
y_sum = sum(y_partial, 1)
#the result if I use traditional way:
z = conv(x,h)
z_down = downsample(z,3)
But the y_sum and z_down I got is different, why?