function out = HPF_ECG(x1,Fs)

% This function allows to remove the baseline wander of an ECG signal.
% It applies a highpass Butterworth filter to the signal x1.

% out = HPF_ECG(x1,Fs)
% Inputs:
% X1: ECG vector
% Fs: Sampling frequency
% Outputs:
% out: Filtered ECG signal
 
% Author: Miguel Altuve, maltuve@usb.ve
% Grupo de Bioingenieria y Biofisica Aplicada, Universidad Simon Bolivar
% Last updated: April 16, 2014

% Butterworth filter, order=7, cutoff = 0.5 Hz
[b,a] = butter(5,0.5/(Fs/2),'high');
out = filtfilt(b,a,x1);


