Please see sample code below for usage of filter
function in Matlab. For truncated input, I expected to get exact result up to the truncate point, but there are tiny differences, although it is within double precision. Is this expected behavior?
X = randn(10000,1);
b = ones(1, 500) / 500;
Y = filter(b,1,X);
Y1 = filter(b,1,X(1:end-1));
tmpdiff = Y(1:end-1)-Y1;
sum(abs(tmpdiff)) % not equal to zero; in the order of 10^(-16)
plot(tmpdiff) % some spikes