Development of a Matlab Software for Analysis of Heart Rate Variability João Luiz Azevedo de Carvalho a , Adson Ferreira da Rocha a , Francisco Assis de Oliveira Nascimento a , João Souza Neto a , Luiz Fernando Junqueira Jr. b a University of Brasília, Department of Electrical Engineering, Brasília, DF, Brazil b University of Brasília, Department of Clinical Medicine, Brasília, DF, Brazil Contact Address: Adson Ferreira da Rocha, Departamento de Engenharia Elétrica, Universidade de Brasília, Brasília, DF, Brazil, 70510-900 e-mail: adson@unb.br Abstract—The analysis of heart rate variability (HRV) signals is an important tool for studying the autonomic nervous system, as it allows the evaluation of the balance between the sympathetic and parasympathetic influences on heart rhythm. This paper presents a tool for analysis of HRV called ECGLab, which was developed in Matlab language in order to help research on HRV by making the analysis process faster and easier. The software obtains the HRV signal by using an automatic QRS detection algorithm. The user can inspect the ECG and correct mistakes in the detection process, and also identify ectopic beats. Importing RR intervals from previously typed ASCII files is also possible. Some of the most popular HRV analysis techniques were implemented: statistical and time series analysis, spectral analysis (using FFT, auto-regressive and Lomb methods), Poincaré plot analysis and sequential trend analysis. I. INTRODUCTION HIS paper presents a tool for analysis of heart rate variability (HRV) called ECGLab, which was developed for Matlab 5. The software was designed to help HRV researchers by making it easy to measure the RR intervals, generate statistics and obtain graphs. This tool was developed in Matlab language because of the built-in functions provided by the Math Works Inc. software, which help in implementing the more complex algorithms, such as statistical measures, matrix operations and digital signal processing algorithms. Matlab is also a powerful system for plotting graphs and its open source nature allows one to adapt the software for his needs. The graphic user interface development is not as easy as on Borland Builder or Delphi, but the availability of built-in DSP and statistics algorithms and graphic functions turned Matlab into the software of choice as the development environment for ECGLab. Analysis of HRV signals is important when studying the autonomic nervous system because it helps in evaluating the equilibrium between the sympathetic and parasympathetic influences on the heart rhythm. The sympathetic branch of the nervous system increases the heart rhythm, resulting in shorter beat intervals. The parasympathetic branch decelerates the heart rhythm, resulting in longer beat intervals. Thus the heart rate variability can be measured based on the beat intervals, which are more easily observed as RR intervals. However, the manual measurement of RR intervals from ECG tapes is time-consuming, and a layman in the field of digital signal processing will find it very difficult to calculate all the parameters that are usually obtained from the HRV signal. There are software packages which implement some of the algorithms presented in ECGLab, but not all of them. Hence, cardiologists and nervous system specialists will find this tool useful for their research activities. The ECGLab software is divided in modules, which implement different steps of the HRV signal attainment and analysis. The first one is the ECG filtering module, which removes 60 Hz noise, muscular noise and baseline fluctuations. Then, there is the QRS detection module, which allows the user to inspect the ECG and correct mistakes in the automatic detection process, and also to identify ectopic beats, which can be removed later on. Finally, there are four HRV analysis modules: statistics and time series analysis, spectral analysis, Poincaré plot analysis and sequential trend analysis. The analysis modules can be used with HRV signals obtained from ECGLab and also with RR interval series from previously typed ASCII files. Each one of the main modules is explained in the next sections. II. QRS DETECTION MODULE Heart rate variability signals describe either the time period elapsed between successive heartbeats or the “instantaneous heart rate” on each beat instant. Thus the first step of HRV analysis is the detection of the heartbeat time instants. The most precise way of doing that is through QRS detection. The QRS complex can be detected with a bandpass filter centered at 17 Hz and using a Q factor of 3. The 17 Hz pass frequency gives maximum SNR and a Q of 3 yields an optimum ripple length for detection [1]. The digital T