I have a data series


that I want to filter using a low-pass AR1 filter. I found that this filter has a transfer function


with omega_c the cut-off frequency. [Error: this is not a discrete time filter.]

If I implement this in Matlab:

filter(1,[1 1/(2*pi*500)],y)

it does not give a correct result. Is there an error in my reasoning?

  • 1
    $\begingroup$ How did you go about discretising your transfer function to produce those coefficients? $\endgroup$
    – Speedy
    Oct 24, 2016 at 17:13
  • $\begingroup$ @Speedy You mean that H(s) is in continuous time and I have to discretize it in order to be able to use it with a discrete time data series y(n)? $\endgroup$
    – Karlo
    Oct 25, 2016 at 15:23
  • 1
    $\begingroup$ Exactly - I ask because you've presented your problem and attempted solution but not the reasoning you used to get there. $\endgroup$
    – Speedy
    Oct 25, 2016 at 17:04
  • 1
    $\begingroup$ @Karlo Your H is written for continuous-time. Does it mean you want to design an analog filter? Isn't your data discrete? $\endgroup$
    – msm
    Oct 26, 2016 at 3:32
  • 1
    $\begingroup$ @Karlo OK, I will give an answer shortly. $\endgroup$
    – msm
    Oct 26, 2016 at 19:45

1 Answer 1


An autoregressive filter is referred to as IIR (infinite impulse response) filter in signal processing. You have several options to do that. In Matlab, one way is to use commands like

[b,a] = butter(n,wn);             % Butterworth
[b,a] = cheby1(n,Rp,ws);          % Chebyshev Type I
[b,a] = cheby2(n,Rs,ws);          % Chebyshev Type II
[b,a] = ellip(n,Rp,Rs,ws);        % elliptic

where wn is the normalized cutoff, ws is normalized edge frequency, and Rp and Rs are the ripples of passband and stopband in dB (for more details see the documentation). Then use filter with the designed a and b.

If you want to design it yourself, your current analog filter can be a good starting point. You can use bilinear transformation to build your digital filter from an analog transfer function. Let's say your sampling period is $T$ (assume $T=1$ if it is just a series). Using this transform you should substitute $$s=\frac{2}{T}\frac{1-z^{-1}}{1+z^{-1}}\tag{1}$$ in the analog $H(s)$, to find the digital filter. One can show that the relationship between the cutoff frequency of the analog filter ($\omega_a$) and that of the digital filter ($\omega_d$) is $$\omega_a=\frac{2}{T}\tan\frac{\omega_d T}{2}\tag{2}$$ So if your desired digital filter's cutoff is $\omega_d (=2\pi f_d)$, then find the equivalent analog cutoff from $(2)$, and then your digital filter is just $H(s)$ with the given $s$ in $(1)$.

If you are strictly looking for a first order digital AR filter of the form $$H(z)=\frac{1-a}{1-az^{-1}}$$ then $$H(j\omega)=\frac{1-a}{1-ae^{-j\omega}}$$ and

$$|H(j\omega)|=\frac{1-a}{|1-ae^{-j\omega}|}=\frac{1-a}{|1-a\cos(\omega)+ja\sin(\omega)|}=\frac{1-a}{\sqrt{1-2a\cos(\omega)+a^2}}$$ With that, you can find $a$ with respect to the cutoff frequency.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.