Evaluates a Linear Constant Coefficient Difference Equation.
FILTEQ(b, a, x, yi, xi)
(y, zf) = FILTEQ(b, a, x, zi)
(y, yf, xf) = FILTEQ(b, a, x, yi, xi)
b |
- |
A series, x[n] coefficients. |
a |
- |
A series, y[n] coefficients. |
x |
- |
A series, the input data. |
zi |
- |
Optional. A series, the initial conditions in difference equation state form. |
yi |
- |
Optional. A series, the y[-k] initial conditions. |
xi |
- |
Optional. A series, the x[-k] initial conditions. |
A series.
(y, zf) = FILTEQ(b, a, x, zi) returns the filtered series and final conditions in difference equation state form.
(y, yf, xf) = FILTEQ(b, a, x, yi, xi) returns the filtered series and final conditions in difference equation direct form.
x = {1, 0, 0, 0, 0}
y = filteq({1, -0.5}, {0.8, -0.2, -0.5}, x)
y == {1.0, 0.3, 0.04, -0.528, -0.5804}
y is the output produced by the difference equation:
W1: gimpulse(1024,1)
W2: filteq({1,-0.5}, {0.8,-0.2,-0.5},W1)
W3: spectrum(W2);setxlog(1);setylog(1,0,1)
calculates 1024 samples of the impulse response of the above difference equation. The spectrum in W3 shows a resonate peak at approximately 0.127 Hertz.
x = {1, 0, 0, 0, 0}
y = filteq({1, -0.5}, {1, -0.2, -0.5}, x)
y == {1.0, -0.3, 0.44, -0.062, 0.2076}
Because a[1] = 1, y is the output produced by the difference equation:
or the equivalent
b = {1, -0.5};
a = {1, 0.5, -0.5};
W1: gnorm(200, 1);
W2: filteq(b, a, w1);
W3: extract(w1, 1, int(length(w1)/2));
W4: extract(w1, 1 + int(length(w1)/2), -1);
W5: (y, zf) = filteq(b, a, w3);y;
W6: filteq(b, a, w4, zf);
W7: concat(w5, w6);
W8: w2 - w7;
W1 contains 200 samples of random noise.
W2 filters the series with a finite difference equation.
W3 and W4 divide the series in W1 into two segments.
W5 filters the first segment and returns the final conditions.
W6 filters the second segment setting the initial conditions to the final conditions of W5.
W7 combines the output results and W8 shows the two processes return the same. The initial and final conditions are represented in difference equation state form.
b = {1, -0.5};
a = {1, 0.5, -0.5};
W1: gnorm(200, 1);
W2: filteq(b, a, w1);
W3: extract(w1, 1, int(length(w1)/2));
W4: extract(w1, 1 + int(length(w1)/2), -1);
W5: (y, iirzf, firzf) = filteq(b, a, w3);y;
W6: filteq(b, a, w4, iirzf, firzf);
W7: concat(w5, w6);
W8: w2 - w7;
Same as above except the initial and final conditions are represented in difference equation direct form.
If a[1] ≠ 1, FILTEQ evaluates a linear constant coefficient difference equation of the following form:
or equivalently:
If the initial conditions zi are provided as a single series, the values are assumed to be in difference equation state form.
If two
series yi and xi
are provided, yi specifies the
initial conditions
If no initial conditions are provided, both yi and xi are assumed to be 0.
z^{ } |
=^{ } |
e^{ jω} complex frequency |
N |
= |
number of numerator terms |
M |
= |
number of denominator terms |
This form represents the following difference equation:
See SOSFILT to process a filter implemented with coefficients in second order section form.