**BioStatMatt » R**, and kindly contributed to R-bloggers)

After reading (most of) “The Scientists and Engineers Guide to Digital Signal Processing” by Steven W. Smith, PhD, I decided to take a second crack at the ECG data. I wrote a set of R functions that implement a windowed (Blackman) sinc low-pass filter. The convolution of filter kernel with the input signal is conducted in the frequency domain using the fast Fourier transform, which is much of the focus of Smith’s book.You can check out the complete R script. Also, you can reproduce the analysis and the image below in R by running the following command

source("http://biostatmatt.com/R/ecg.R")

The low-pass filter was first applied to eliminate the high frequency noise, anything greater than 30Hz. I next applied the filter at a cutoff frequency of 1Hz in order to isolate the slow wave that corresponds to respirations. The image below gives the sequence of filtering.

**leave a comment**for the author, please follow the link and comment on his blog:

**BioStatMatt » R**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...