Help designing Butterworth filter I am trying to bandpass filter a signal using a butterworth filter, but I am getting the following result (click to enlarge): 



The original signal is the blue and the filtered one is the green.

Why does the first part of the filtered signal (from 0 to 50) is changing so much from the original? Can you help me understand why this is happening?

Here goes some details:


Signal length: 256
Frequency: 22Hz
Cutoff frequencies: 0.7Hz and 3.0Hz
Filter order: 6


Python code:

nyq = 0.5 * fs
low = lowcut / nyq
high = highcut / nyq
b, a = butter(order, [low, high], btype='band')
y = lfilter(b, a, data)
The first part of the response may be a result of the transient response of the Butterworth filter.  Also note that the signal is phase shifted and the basic shape is altered.  This looks like the result of phase distortion.  You may want to try again using a Bessel filter which has better transient and phase characteristics.  If you are using DSP, you can also try a true linear phase FIR approach.  This will yield the best transient and phase characteristics.