5 % apply a zerophase FIR filter (coeffs designed with sptool)
6 % Least Sq. FIR LP & HP filters (cascaded): 70dB 0.05-40Hz 1dB ripple.
7 % Sampling Frequency of Fs = 256.
9 % Should work nicely for 16bit, 256Hz ECG. You may experince
10 % some ringing at turning points, but that
's FIR filters for you.
11 % You might like to try wavelets for a better filter
13 % These routines are made available under the GNU general public license.
14 % If you have not received a copy of this license, please download from
17 % Please distribute (and modify) freely, commenting where you have
18 % added modifications. The author would appreciate correspondence
19 % regarding corrections, modifications, improvements etc.
21 % G. Clifford : gari@ieee.org
26 % Data should be zeromeaned before calling this function
27 data = data - mean(data);
29 % set up transfer function
368 -0.000978288661010672
369 -0.000949570338620629
372 -0.000867737622092878
373 -0.000840693466317883
374 -0.000814687362552657
375 -0.000788276159757994
376 -0.000762827770843517
377 -0.000737050063062293
378 -0.000712345353053305
379 -0.000687428482340838
380 -0.000663561635529363
381 -0.000639451830525362
382 -0.000616537270116216
383 -0.000593529464503111
384 -0.007719806995443 ];
388 aff_lp = filtfilt(numerator_lp, denominator, data);
390 % Don't high pass filter it if you don
't want to remove the baseline
391 % fluctuations due to resp, BP? and electrode noise?
392 filtdata = filtfilt(numerator_hp, denominator, aff_lp);
394 % correct for amplitude distortion. !!!??????
395 %mean_s = mean(new_data);
396 %mean_a = mean(aff_hp);
397 %a = aff*(mean_s/mean_a);