
#
# Create a Butterworth lowpass filter 
# -----------------------------------

tstep= 0.010;                   # Time step
Fsamp= 1./tstep;                # Sampling frequency in Hz
Fnyq = Fsamp/2.;                # The Nyquist frequency is half your sampling frequency
Fc_butter1= 2.;                 # Cut-off frequency of your Low pass filter in Hz
nth_butter1= 2;                 # The order of the low-pass Butterworth filter.

# [b_butter1,a_butter1]= butter(nth_butter1, Fc_butter1/Fnyq);  # Create a first-order Butterworth low pass. Cutoff frequency normalized with Fnyq

a_butter1= [1.00000000000000e+00  -1.82269492519631e+00   8.37181651256023e-01];
b_butter1= [3.62168151492864e-03   7.24336302985728e-03   3.62168151492864e-03];
nval_butter1= length(a_butter1);
if (length(b_butter1)>nval_butter1) nval_butter1= length(b_butter1); endif
delay_butter1= zeros(nval_butter1,2);   # Storage for time-shift
