2
$\begingroup$

I recently implemented a Butterworth high-pass filter (2nd order). Everything seems to work fine, except that I have a question when applying such a filter to a constant signal. As there are no high-frequency components in a constant signal, I would expect the filter to yield a constant 0 signal.

In the plots below are my results. There seems to be ``ripple'' in the first couple of frames before the high-pass filtered signal (correctly) converges to 0.

Is this a logical result from applying a Butterworth high-pass filter on a constant signal, or might there be a bug in my code?

EDIT: I've created the same filter in Octave, resulting in the same output. This indicates that we're indeed looking at the step response, as Paul R. indicates.

enter image description here

Octave outputenter image description here

$\endgroup$
  • 1
    $\begingroup$ You should probably delete your original question from StackOverflow, since cross-posting is frowned upon in the StackExchange community. $\endgroup$ – Paul R May 22 '15 at 14:36
  • 1
    $\begingroup$ Indeed it is what is expected. You could try filtfilt if you really want to, but that is only for an off-line processing. $\endgroup$ – jojek May 22 '15 at 15:00
  • 2
    $\begingroup$ This is called "transient response" (because there's actually a change in your input signal: a step). This transient response dies out and what remains is the steady state response, which is - as expected - zero. $\endgroup$ – Matt L. May 22 '15 at 16:13
6
$\begingroup$

The input to your filter is essentially a step function (since it has value 0 prior to t = 0, and a positive value for t > 0), so you see the step response of the filter, hence the initial ringing. This is expected behaviour, and after a suitable amount of time the step response will have settled to zero.

| improve this answer | |
$\endgroup$
-3
$\begingroup$

You used to low-order filter(2nd order). This can be reason that composing high ripples at starting frequency points.I think you can increase the order of filter and try it on your design.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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