filtic
Determine the initial state condition of an IIR filter, given the input and output signal histories.
Syntax
zf=filtic(b,a,y,x)
zf=filtic(b,a,y)
Inputs
- b
- The numerator polynomial coefficients of the filter.
- a
- The denominator polynomial coefficients of the filter.
- y
- The output signal history, stored in reverse order.
- x
- The input signal history, stored in reverse order.
Outputs
- zf
- The initial state conditions.
Example
Find the initial conditions needed to resume filtering a signal after 10 samples.
[b,a] = butter(5,0.4);
f1 = 62.5;
f2 = 250;
omega1 = 2*pi*f1;
omega2 = 2*pi*f2;
fs = 2000;
ts = 1/fs;
n = 10;
t = [0:1:(n-1)] * ts;
xx = sqrt(2) * sin(0.5*omega1*t) + sin(omega1*t) + 0.25 * sin(omega2*t);
yy = filter(b,a,xx);
x = xx(n:-1:1);
y = yy(n:-1:1);
zi = filtic(b,a,y,x)
zi = [Matrix] 5 x 1
1.82485
0.01485
1.22198
0.13002
0.06730
Comments
If the filter coefficient vectors are of unequal length, the shorter vector is padded with zeros to make the lengths equal.
If either signal vector is shorter than the coefficient vectors it is padded with zeros. There is no benefit in the signal vectors being longer than the coefficient vectors since the calculations only reference the required samples, which are the newest.