I am using IIR filter for smoothing
$$y[n] = ax[n]+(1-a)y[n-1]$$
My question is, if I add another IIR filter, will it be the second order of IIR filter? If not, what it can be called?
My second filter is
$$y_2[n] = ay[n] + (1-a)y_2[n-1] $$
Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. It only takes a minute to sign up.
Sign up to join this communityI am using IIR filter for smoothing
$$y[n] = ax[n]+(1-a)y[n-1]$$
My question is, if I add another IIR filter, will it be the second order of IIR filter? If not, what it can be called?
My second filter is
$$y_2[n] = ay[n] + (1-a)y_2[n-1] $$
If you apply two filters in a series cascade, then the behavior of the cascade can be expressed in two different ways. In the time domain, the overall system's impulse response can be calculated by convolving the impulse responses of $y[n]$ and $y_2[n]$ together. For IIR filters, this can be somewhat cumbersome.
In the frequency domain, the overall system's $z$-domain transfer function can be calculated by multiplying the transfer functions $H_y(z)$ and $H_{y_2}(z)$ together. This is usually a much easier route for filters with feedback.
In your case, the two filters actually have the same input/output relationship (assuming that $y[n]$ is the input to $y_2[n]$. Using the $z$-transform, it's easy to find that:
$$ H_y(z) = H_{y_2}(z) = \frac{Y(z)}{X(z)} = \frac{a}{1 - (1-a)z^{-1}} $$
Using the relationship I mentioned above, you can calculate the transfer function of the two filters in cascade using:
$$ H(z) = H_y(z) H_{y_2}(z) = \left(\frac{a}{1 - (1-a)z^{-1}}\right)^2 $$
$$ H(z) = \frac{a^2}{1 - 2(1-a)z^{-1} + (1-a)^2z^{-2}} $$
We can just as easily use the inverse $z$-transform to arrive back at the difference equation for the two cascaded filters:
$$ y_c[n] = a^2x[n] - 2(1-a)y[n-1]+(1-a)^2y[n-2] $$
By inspection, we can state that this is a second-order filter (provided $a \not= 1\ $), as you suspected.
Yes, the combination of the two first order IIR filters would be called a 2nd order IIR filter. The process of combining two first order filters to form a second order filter is called cascading.