Zero-frequency response of an IIR transfer function I have a question about the zero-frequency (DC) response of a IIR filter. The coefficients of the 3rd order IIR filter are as follows,

% polynomial coefficients for the numerator of the IIR transfer function
b = [0.0066324, -0.0130292, 0.0063988]; 

% polynomial coefficients for the denominator of the IIR transfer function
a = [1, -1.4158855, 0.4158913];  


Note that the roots of a are all less than unity, but one is quite close to the unity. I am trying to understand why MATLAB's filter() function produces the following results:

rng default;
x = rand(15,1);
y = filter(b,a,x);
mean(y)/mean(x)   

&gt;&gt; 0.0012


In the last statement, I computed the ratio of the input and output mean, MATLAB returns 0.0012.

However, from the zero-frequency of the transfer function $H(z)=0.3448$ (i.e., sum(b)/sum(a)=0.3448), I have expected that mean(y)/mean(x)=0.3448. Checking this,

[H,W] = freqz(b,a);
H(1)

&gt;&gt; 0.3448


Have I misunderstood something here about MATLAB's filter() function, or other misconception of the zero-frequency response of a transfer function? Thanks to anyone who is able to provide an insight to this problem.
Because of the pole near the unit circle the impulse response doesn't really settle until after tens of thousands of samples. In comparison, your input of 15 samples is very short. Try making it longer:

x = rand(15E6,1);
y = filter(b,a,x);
mean(y)/mean(x)

&gt;&gt; 0.34252


Also, the filter starts in a state that corresponds to an all-zeros input history. If you precondition it with a run of the actual input, the result will converge faster:

x = rand(15E6,1);
y = filter(b,a,x);
mean(y(5E6:length(y)))/mean(x(5E6:length(x)))

&gt;&gt; 0.34483