Next Article in Journal
Fast Optical Signals for Real-Time Retinotopy and Brain Computer Interface
Previous Article in Journal
Dental Fiber-Post Systems: An In-Depth Review of Their Evolution, Current Practice and Future Directions
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A New Algorithm for Estimating a Noiseless, Evenly Sampled, Heart Rate Modulating Signal

by
Enrico M. Staderini
1,*,
Harish Kambampati
2,
Amith K. Ramakrishnaiah
3,
Stefano Mugnaini
4,
Andrea Magrini
4 and
Sandro Gentili
4
1
Healthy World Association Switzerland, 1400 Yverdon-les-Bains, Switzerland
2
Doctorate School in Industrial Engineering, “Tor Vergata” University of Rome, 00133 Roma, Italy
3
Department of Electronics Engineering, “Tor Vergata” University of Rome, 00133 Roma, Italy
4
Occupational Medicine Section, Department of Biomedicine and Prevention, “Tor Vergata” University of Rome, 00133 Roma, Italy
*
Author to whom correspondence should be addressed.
Submission received: 4 April 2023 / Revised: 27 April 2023 / Accepted: 29 April 2023 / Published: 4 May 2023

Abstract

:
Heart rate variability (HRV) is commonly intended as the variation in the heart rate (HR), and it is evaluated in the time and frequency domains with various well-known methods. In the present paper, the heart rate is considered as a time domain signal, at first as an abstract model in which the HR is the instantaneous frequency of an otherwise periodic signal, such as with an electrocardiogram (ECG). In this model, the ECG is assumed to be a frequency modulated signal, or carrier signal, where HRV or H R V ( t ) is the time-domain signal which is frequency modulating the carrier ECG signal around its average frequency. Hence, an algorithm able to frequency demodulate the ECG signal to extract the signal H R V ( t ) is described, with possibly enough time resolution to analyse fast time-domain variations in the instantaneous HR. After exhaustive testing of the method on simulated frequency modulated sinusoidal signals, the new procedure is eventually applied on actual ECG tracings for preliminary nonclinical testing. The purpose of the work is to use this algorithm as a tool and a more reliable method for the assessment of heart rate before any further clinical or physiological analysis.

1. Introduction

In this paper, the authors assume that the variation of the heart rate, hence the frequency variation of the ECG, is a time domain signal per se, which frequently modulates the ECG. This model assumption is similar to frequency modulated (FM) radio broadcasting where an audio signal is used to frequency modulate the radio frequency carrier. Frequency demodulation for recovering the audio signal, at the radio receiver end, is a straightforward and well-known process, but it appears to be very tricky and put to its physical limits, when considered for the heart rate “carrier” and, in our case, when a large bandwidth of the recovered modulation signal is needed to be preserved.
Discussion of the origin of heart rate modulations or heart rate variability is outside the scope of this paper. The new method completely disregards the physiology of the heart and the mechanisms that influence and define the heart rate in real time. It is not the intention of the authors to investigate the physiology of the heart or to propose any new insight into it; on the contrary, a method is proposed for extracting a clean heart rate variability signal from a heart-activity-related signal such as an electrocardiogram (ECG). Our interest in the physiology of the phenomena implied in heart rate control is limited to the understanding that the ECG is a frequency modulated signal (the times of occurrence of R-waves are not evenly spaced in time), thus one is looking for a continuous time signal reflecting the inverse of the instantaneous time delay between the R-wave events, and this signal is called the instantaneous heart rate, and indicated as H R ( t ) . This signal is not to found solely in any particular organ or physiologic mechanism in the body; in this paper it is considered only from a black box point of view, as depicted in Figure 1.
Contrary to commonly known HRV analysis methods, in this paper the authors are looking for an algorithm that is able to detect very fast variations in the heart rate or fast, non-rhythmic variations intervening in a few heart cycles. In a nutshell, our method is going to demodulate the signal frequency R ( t ) to recover the assumed frequency modulating signal H R V ( t ) . The latter signal, no matter if it is periodic or not, will then be used for the study of any particular heart rate variability analysis that might be required.
The aim and need of the new algorithm presented here will be better understood in comparing its results with those obtained with more common interbeat interval plotting followed by interpolation/smoothing.

1.1. Intrinsic Signal Analysis Problems in the Frequency Demodulation of the ECG Signal

Comparing the frequency band occupation of a radio FM signal with the frequency occupation of the E C G ( t ) signal (simplifying the ECG as a sinusoidal signal to also avoid the spectral content of its waveform) may be very instructive in highlighting the originality and importance of this new method.
It is important to go through the basics of FM radio to understand the difficulty in the recovering of H R V ( t ) from the E C G ( t ) signal.
FM radio broadcasting is very popular (although it has now become obsolete with the introduction of digital audio broadcasting, or DAB). In the famous 88–108 MHz radio band, many FM stations are allocated with a spacing of 200 kHz, while a maximum modulation deviation of ±75 kHz is permitted for sending stereo audio signals in a band from tens of Hz to 50 kHz (also considering stereo multiplexing). It is very well-known that the intrinsic non-linearity of the frequency modulation process makes the calculation of the occupied band of the modulated signal very difficult to assess. The popular Carson bandwidth rule [1] gives a rough estimation of the bandwidth (Carson Bandwidth or CB) of a signal frequency modulated by another signal having a maximum frequency f m with a maximum permitted frequency deviation of the carrier Δ f from the non-modulated carrier frequency:
C B = 2 ( f m + Δ f )
For an FM radio emission with f m = 53 kHz and Δ f = 75 kHz, one gets C B = 256 kHz, which is even a bit larger than the allocated band for each FM radio channel.It is worthy of note that the occupied band is just 0.26 percent of the carrier (at the center band of 98 MHz).
The same calculation for the frequency modulated ECG signal is quite astonishing: first, one may assume that the possible absolute maximum deviation of the heart rate from a given average (normal) heart rate would be in the order of 40 beats per minute (bpm) or 0.7 Hz, meaning that one might expect, for example, for the heart rate running at 70 bpm (1.17 Hz) to slow down to 30 bpm (0.5 Hz) or rise to 110 bpm (1.8 Hz) although this is just an assumption that uses approximate figures; second, the maximum frequency of the variation might be assumed to be a bit larger than breath frequency, which is a well-known modulator of the heart rate, for instance a maximum of 15 events per minute (0.25 Hz). This is just for the sake of having some acceptable figures to let us compute the CB. Thus, for the heart rate of 70 bpm (1.17 Hz), one has f m = 0.25 Hz and Δ f = 0.7 Hz, which gives C B = 1.9 Hz, explaining the intrinsic difficulty or even impossibility of a correct estimation of the HRV, as the signal modulating the heart rate has a larger bandwidth than the carrier (average heart rate) itself. Indeed, in the calculation above, they were considered as maximum values, as it is uncommon for the breath-frequency-induced HRV to have a shift of 40 bpm. Furthermore, the problem remains, as the CB of the heart rate signal is still comparable to the average heart rate itself.

1.2. Competing Methods for the Frequency Demodulation of the ECG Signal

In conclusion, it must be admitted that the heart is running too slowly to correctly carry the expected heart rate variability modulation; hence, it can be said that, in general, the detection of the heart rate variability signal from any heart-activity-related physiologic signal, such as the ECG, is conceptually impossible. It may be surmised that this problem is the basic reason for the large number of methods [2], and their differences, that have been utilized so far for heart rate variability assessment and analysis.
The concepts previously highlighted make the use of standard frequency demodulators, commonly used in radio technology, impossible. Indeed, HRV has always been evaluated by computing the actual time delays of the arrival of each individual heartbeat or instantaneous heart period, starting from the interbeat interval values.
There are two problems to underline. First, no matter the demodulation process used to estimate H R V ( t ) , a continuous heart rate modulation signal will never be obtained, as the instantaneous heart rate is not available at each instant of time but only at each heartbeat (by computing the inverse of the instantaneous heart period). Thus, the heart rate variability signal, which one assumes in the black box model as a signal that is continuous in nature, is not available in a continuous form (as with the blood pressure signal, for example). Second, it is true that biological signals are always numerically acquired in a sampled form, but the sampling frequency is normally chosen by the experimenter, while with the H R V ( t ) signal, one should follow the sampling frequency of the signal (which is the heart period) and the heart period, or heart rate, is exactly what the experimenter is looking for. So, the visible HRV signal is in general a non-continuous signal available at its own sampling frequency, which is, by the way, the signal itself.
It is the opinion of the authors that there is no need to review all of the HRV acquisition and analysis techniques that have been developed so far. All of these algorithms can be roughly divided into long-term and short-term HRV analysis methods depending on the length of the ECG epoch to be studied. The results can also be divided into time- or frequency-based analyses. The readers well acquainted in this field know the story very well. For the other interested readers, reference [2] is suggested.
As explained above, the method described in this paper is now in need of a reliable H R V ( t ) signal, and not for its physiological meaning. Nevertheless, it is important to discuss and review the current state of research in the field, with special attention devoted to the papers dealing with the problem of HRV signal detection, recording, and resampling. Of special interest for our work is the paper by [3,4,5], where the effects of resampling the frequency of the RR interval and the length of the epoch of analysis are considered with regard to the evaluation of the autonomic nervous system. Rapid variations of the acceleration and deceleration of the heart rate were also analyzed in [6,7,8], where interest was given to the preprocessing of unevenly sampled RR interval signals using interpolation and resampling.
With regard to comparing HRV analysis methods, it is important to mention the Lomb-Scargle periodogram [7,8,9,10,11], which can be used for a reliable estimation of the frequency spectrum of unevenly sampled signals such as the RR series. The Lomb-Scargle periodogram is more common within the astronomical research community, but it is, quite unfortunately, less popular in the HRV research community, mostly because of the mathematical difficulties in understanding it. In any case, Lomb-Scargle is looking for rhythmical variations in the RR series, while it is better to remain general and not assume any special behavior of the HR modulating signal. This means that at this moment one is not looking at the frequency of variation of the heart rate, as no assumption of stationarity can be used on it.
The problem of resampling and the actual final sampling rate of the HRV signal has also been studied in [12,13,14], where another time domain measure of HRV has been introduced. Errors and effects introduced in the resampling process of HRV were also studied in other papers [15,16,17,18,19,20].
The present paper introduces yet another method for obtaining a resampled and clean HRV signal out of a sequence of RR intervals, with the aim of preserving the bandwidth of the frequency-modulating signal, even on short or ultra-short time epochs.

2. Materials and Methods

2.1. Algorithm for the Estimation of the Instantaneous Heart Rate Signal from the ECG

As already stated, the presented algorithm aims to obtain a signal representative of the “instantaneous” heart rate. This signal should be provided with a sampling rate even higher than the heart rate itself.
There are two standard and straightforward methods of extracting the heart rate signal from the ECG signal [2]; both methods start with measuring each heart period and convert it to frequency by calculating the inverse. The resulting collection of measures will normally be unevenly spread in time as the time delay between a measure and the following is only equal to each heart period, which varies. Thus, one may say that the H R ( t ) signal is available only in an unevenly sampled fashion, where the actual sampling is the signal itself. To create an evenly sampled, resampled heart rate signal extracted from the set of measures, the first way is by distributing each sample measure on a reconstructed sampling frequency equal to the average heart rate in the epoch to be analyzed. The second method involves leaving the measures at the instants of time where they were taken, and interpolating them on an evenly distributed instant of time. The same interpolation is to be done when using the first method if a larger number of points is required. This problem is commonly known as resampling. Both methods will provide an H R ( t ) signal suitable for subsequent analysis in the frequency domain, but is relatively poor for direct study in the time domain. Indeed, time-domain studies of H R ( t ) are almost never done on the waveform of H R ( t ) but, more often, are performed on indexes extracted from it [2].
The method used in this paper aims to obtain a signal H R ( t ) that might be directly analyzed for the study of fast transitory events appearing in the signal itself. Indeed, the final goal and the advantage of the algorithm about to be described is that it can catch rapid variations in the heart rate, although they are not rhythmical, which might be related, for example, to sudden correlated variations in the activity of the autonomic nervous system.
Thus, the problem to be tackled is that of estimating the signal H R V ( t ) , or H R ( t ) , from the E C G ( t ) . At first, it must recognized that neither H R V ( t ) nor H R ( t ) can be directly measured with appreciable time resolution. Indeed, even assuming that one had a reliable R-wave detector on the signal E C G ( t ) , one could just measure H R ( t ) at each nth heartbeat occurring at the instant of time t n . It is worthy of note that the H R ( t ) signal is the only biological signal that is naturally available in sampled form; moreover, as already noted above, its sampling instants of time are the signal itself.
In this new proposed method, a new signal S R ( t ) is first built as the cumulative sum of the heart beats (or complete E C G ( t ) cycles). A suitable, evenly spaced sampling time t s for the S R ( t ) signal is defined. This means that the S R ( t ) will be created as a signal sampled at a frequency of our choice: f s = 1 t s . A convenient sampling frequency for f s is chosen which is often even higher than the actual heart rate, and certainly much higher than the frequency content of H R ( t ) , and perhaps one will even use the same sampling frequency at which the signal E C G ( t ) itself was acquired. Next, at each instant of sampling, the following rule is applied:
If a heartbeat (R-wave) has occurred (has been detected) at an instant of time t n , where t i 1 < t n t i , then S R ( t i ) = S R ( t i 1 ) + 1 , otherwise S R ( t i ) = S R ( t i 1 ) .
This means that S R ( t ) will be built as the running count function of the detected heartbeat. It is obvious that it will be a not-descending function of time; it will be sampled at the frequency f s with an obvious [instantaneous] slope equal to H R ( t ) beats per minute. Indeed, the word “instantaneous” is used in brackets because the signal S R ( t ) is a sampled staircase signal which remains constant during many time samples between each heartbeat and that following it. Note that the signal S R ( t ) rises as faster as higher is the actual signal H R ( t ) : indeed, supposing H R ( t ) be constant at 70 bpm, then S R ( t ) will obviously grow at a rate of 70 units per minute.
Thus, H R ( t ) may be evaluated as just the first derivative of S R ( t ) :
H R ( t ) = d S R ( t ) d t   in   bpm .
As H R ( t ) = H R V ( t ) + f 0 ¯ , the signal’s average (mean heart rate) may be subtracted to obtain H R V ( t ) = H R ( t ) f 0 in bpm.
Apart from a series of difficulties which will be discussed, it is worth noting that the estimated H R V ( t ) signal is in principle known with a remarkable time resolution (it is sampled at a very high sampling frequency), and hence it is helpful for ultra-short term heart rate variability (USTHRV) studies. Such studies are also useful in the detection of fast and short-lived heart rate variations (time domain HRV studies), provided that the required minimum signal epoch is available.
The authors are convinced that this proposed method is better than the standard method which is based on the interpolation of the inverse of individual heart periods.
The attentive reader will note that computing the signal S R ( t ) and then making the derivative of it is somewhat like performing the inverse of the interbeat interval values followed by interpolation or smoothing. In the present proposed method, the interpolation is still used on the signal S R ( t ) before computing the derivative, and it is also done through low pass filtering, as described below. Nevertheless, the obtained signal still maintains a wide frequency content that may show rapid heart rate variations, along with resampling at a high sampling frequency.
The details of the method will be presented here while applying the algorithm to a special artificial simulated signal which is used to stress and also to better appreciate the results and performances of the proposed processing.
The central assumption put forward in this paper is that any heart activity-related biomedical signal (electrocardiogram ECG, phonocardiogram PCG, photoplethysmogram PPG, etc.) is a frequency-modulated signal, while its instantaneous frequency is known as the instantaneous heart rate. Considering the ECG, whose instantaneous frequency is time-varying, the instantaneous frequency is a time signal. It is useful here to recall the definition of a “signal” as “any observable change of a quantity over time” [21]. That is why the heart rate signal has to be a signal indicated as H R ( t ) . The objective of this paper is to describe a method for the frequency demodulation of the ECG to obtain an estimation of the instantaneous heart rate signal. The carrier signal has a sinusoidal shape in conventionally frequency-modulated signals, such as those used in radio communications. In the case at hand, the heart-activity-related biomedical signal is not sinusoidally shaped. Indeed, the ECG is not sinusoidal, although it may be considered as a periodic signal as well, made of repetitions of the well-known P-Q-R-S-T waves instead of sinusoidally shaped waves. Now, no matter the actual frequency content of the biomedical signal, which depends on its wave shape, the signal with its periodism is considered as the carrier of a frequency-modulating signal in the time domain, which might be named as the heart rate signal. The heart rate signal is not directly available for acquisition in the real world. However, it is known that the heart rate signal is visible as the instantaneous frequency of other signals generated synchronously with heart activity, the electrocardiogram being an example of this.
As the ECG has a large bandwidth relative to other heart-activity-related signals, and given that it is simple to process the determination of the heart rate by the detection of R-waves, the heart rate is commonly inferred from the frequency of the ECG events, as its jitter incertitude is at the minimum. Jitter may be defined as the deviation from the true periodicity of a presumably periodic signal [22]. As the ECG is, by its nature, not periodic, it is evident that the jitter, in assessing the true instant of time at which the R-wave in the ECG is detected, will be made of two components: one component is the natural (physiological) wandering of the heart rate (the scope of our research), and the second component is the instrumental error in detecting the time of arrival of the R-wave (the real instant of the heartbeat event). The first component is the result of the heart rate variability signal (also made of two components: the real wandering of the cardiac physiological pacemaker, which generates P-waves, summed to the wandering of the impulse transmission delay from the physiological pacemaker through the specific heart conduction tissues to the ventricles, which generates R-waves), and the second component is an unavoidable instrumental error. Indeed, an ECG is used thanks to its large bandwidth, and thus on this signal the instrumental error can be kept to a minimum compared to other heart-activity-related biological signals. At the end of the preliminary description, the ECG signal will be used to infer the shape of the heart rate signal, and the instrumental jitter will always be assumed to be zero.
The ECG is obviously considered as the time-domain signal produced by the ventricles’ electrical activation: E C G ( t ) . To better describe our model and without loss of generality, a sinusoidal signal is initially considered as a classical kind of periodic signal that is clearly simpler to manage than the ECG shape itself. Therefore, we will first consider a sinusoidal signal rather than an ECG signal. As one is interested in the wandering of the frequency of repetitions, the shape of what repeats itself is meaningless. To better understand the matter, one can start from Figure 2, where the artificially generated “heart rate signal” is shown.
It may come as a surprise that a square wave is used for simulating the heart rate signal in Figure 2, as heart rate variation never has this shape in nature. Indeed, the choice of a square wave, having a sudden and perpendicular rise in the waveform, has been made to show and test the performance of the algorithm in detecting fast transients in the heart rate variability signal, even if a so rapid a variation is very unlikely to happen in nature.

2.2. Practical Implementation of the Algorithm

A deeper insight is now given into the details of the practical implementation of the algorithm described above. The method is initially used on an artificial simulated signal showing a sudden variation in its frequency. The signal used is of sinusoidal shape because it is much simpler to simulate than an actual ECG-shaped signal. Therefore, the R detector will be temporarily changed in favor of a positive going zero-crossing detector.
Thus, the first step in FM demodulation of the ECG signal is detecting the signal cycles. In the case of the simulated ECG signal (sinusoidal shape), positive zero-crossings are detected, while in the case of a real ECG signal, the peaks of the R-wave will be detected. A positive zero-crossing event in the signal is detected at the instant of time when the signal is crossing the zero-line, traveling from a negative value to a positive value (positive first derivative). As the signal is artificially generated without any noise component, the following very simple MATLAB function has been written for zero-crossing detection:
function pf = zerofind(y)
% zerofind function
%
% This function finds all the positive zero-crossings in the series
% of values passed by y which is a row vector with values to explore for
% zero-crossings
% the function returns a two columns matrix
%—first column contains the indexes where zeroes were found,
%—second columns contains values of y vector at those indexes
% size(pf,1) is the number of zeroes found
%
pf=[];
tdold=0;
iold=1;
for i=2:size(y,2)
  if (y(i-1)<0) && (y(i)>0)
    td=i-iold;
    if (td-tdold)>0
      pf=[pf; i-1 y(i)];
      tdold=td;
    end
  end
end
In the following, the simulated signal as described in Figure 2 is used. Using the zerofind(y) function, the zeroes in the signal are found, and, after this zero-crossing detection, the signal is created by the cumulative sum of the zero-crossing events in time, as shown in Figure 3.
The method for obtaining the cumulative sum signal implies counting the number of cycles detected over time using the following MATLAB script:
% events cumulative summing (or counting of complete cycles)
% vector peaks is the output of the zerofind function
%
sumecg=[0]; % initialize the cumulative sum count signal
j=1;     % initialize index on the peaks matrix
for i=2:(size(ecg,2)-1) % running over the ecg values
  if i>peaks(j,1) % present index just passed event position
    % event found, increment cumulative counter and add
    sumecg=[sumecg sumecg(size(sumecg,2))+1];
    if i<peaks(size(peaks,1),1) % go on if event not found
      j=j+1;
    else
      break; % exit for
    end
  else
    % no event found
    sumecg=[sumecg sumecg(size(sumecg,2))];
  end
end
In the above MATLAB script, the ecg vector is the simulated frequency-modulated signal (or the sampled ECG epoch), and the same vector is passed to the zerofind function above.
The sumecg vector obtained merits some discussion in order to be clearly understood. As already described, it is the summing count of the cycles (zero crossings in the simulated signal or R-waves detected in the ECG epoch). In Figure 3, it is shown as a rising straight line. However, it must be noted that the higher the number of cycles (or R-waves) detected per unit time, the steeper will be the slope of the sumecg vector (which, by the way, is the S R ( t ) signal), so it is not really a straight line. This means that the first derivative of the sumecg vector, or the S R ( t ) signal, should give the instantaneous signal frequency (or heart rate).
The obtained signal is not directly helpful in estimating its first derivative, because it is composed of a series of steps (of a staircase shape) of one count for each cycle, or heartbeat, found. The numerical first derivative is quite a tricky procedure in terms of obtaining a sufficiently smooth and low-noise output signal, and therefore the following steps are taken:
(a) Initially, the S R ( t ) signal is low-pass filtered with a moving average 256 points on a Kaiser-Bessel weighted filter, whose Bode plot is shown in Figure 4 (corresponding, at the sampling frequency used of 128 Hz, to a 2 s epoch and giving a filter delay of 1 s (To recall a basic signal theory concept: the time delay t d for a FIR filter having N taps (points or coefficients) at a sampling frequency f s is equal to t d = ( N 1 ) / ( 2 f s ) .))
(b) Next, a downsampling of the S R ( t ) signal is made to a sampling frequency of 8 Hz, as the maximum bandwidth of the HRV signal is expected to be approximately 0.5 Hz at most (30 cycles per minute)
(c) Eventually, filtering is applied to the downsampled S R ( t ) signal with a differentiating noise-robust filter to obtain the first derivative H R ( t ) or the instantaneous heart rate signal; signal differentiation by FIR filtering is a classical procedure, and therefore the original and robust method proposed by Holoborodko [23] was followed using an 11-order one-sided noise-robust differentiator whose Bode plot is shown in Figure 5; a filter delay of 625 ms is expected. This filter has a linear characteristic at low frequencies (implying a multiplication by the s-variable in the Laplace domain), while at higher frequencies it becomes a low pass.
(d) A final low pass filter is then applied to the H R ( t ) signal with a moving average Kaiser-Bessel 16-point weighted filter whose Bode plot is shown in Figure 6 (corresponding, at the sampling frequency of 8 Hz, to approximately 2 s and giving a filter delay of 937.5 ms); following the differentiating filter, which provides the required first derivative. This moving average filter is then used to clean the output from residuals of the original R-wave detection points (the original carrier frequency).
(e) Eventually, the average value of H R ( t ) is subtracted from itself to obtain the final H R V ( t ) signal or the heart rate variation signal.
Finally, the heart rate signal can be plotted, as is shown in Figure 7. This figure shows how the recovered heart rate signal (bottom trace) closely resembles the simulated signal (top trace in red), which was used to modulate the frequency of the “sinusoidal ECG”. In particular, the step from 77.4 bpm to 63 bpm has been detected with a 2.5-s delay (known from the fixed delays applied by the filters), and the sudden step in the heart rate is detected with a 2-s gentle slope of the recovered signal, which is about two heart cycles in time length. The beginning of the reconstructed signal is affected by the initialization transition period of reconstructing filters or edge effects.

3. Results I: Testing the Algorithm on More Complex Artificially Generated Heart Rate Variability Signals

Software implementation of the simulation in Figure 2 is relatively straightforward, as the frequency-varying sinusoidal signal is composed of epochs in which its frequency is constant (in the example, there are epochs in which the frequency is 77.4 bpm, alternating with epochs at 63 bpm). However, this situation is not what one might expect in general from the frequency wandering of the natural ECG; indeed, in nature, what is expected is a continuous variation of the instantaneous frequency of the ECG. We then put it into formulas. The sinusoidal signal to be used must show continuous frequency wandering behavior, as can be seen in an actual ECG. A sinusoidal signal instead of an ECG-shaped signal will be used. From secondary school, the sinus function is presented as: s i n ( ω t ) = s i n ( 2 π f t ) , which is strictly an accurate periodical signal of period 2 π . For the scope of introducing frequency wandering in the formula, one must re-learn what a sinus function is all about: Given a time domain function H R ( t ) representing the instantaneous value of the frequency of the sinus signal, or heart rate, this can be represented in a formula, as follows:
s i n ( 2 π ( H R ( t ) d t ) )
Should H R ( t ) be reduced to a constant f not depending on time, then the formula above will become the well-known formula for the actual periodic (not frequency wandering) sinus function:
s i n ( 2 π ( H R ( t ) d t ) ) = s i n ( 2 π ( f d t ) ) = s i n ( 2 π f t )
Of course, as the frequency of our “heart sinusoidal signal” is not constant, the first representation as in Formula (3) above is kept.
Following the example in Figure 2, the function H R ( t ) is a time-domain signal whose amplitude is the instantaneous heart rate or the instantaneous frequency of the ECG signal. As a matter of fact, the signal H R ( t ) is considered to be composed of two parts, one constant and another variable in time, such as:
H R ( t ) = f 0 ¯ + H R V ( t )
where f 0 ¯ is the constant average value of H R ( t ) , and the function H R V ( t ) is the variable component or, more appropriately, the heart rate variability signal that was sought. In the example simulated in Figure 2, the following values are used:
f 0 ¯ = 70 bpm, and H R V ( t ) = 7.2 s i g n ( s i n ( 2 π f t t ) ) bpm
where s i g n ( t ) is the sign function, and f t is the frequency of variation of the instantaneous signal frequency (0.02 Hz, meaning the heart rate is changing every 25 s).
In a more general case, f 0 ¯ will be defined as the average (constant) heart rate during a given (short) epoch of signal acquisition, and H R V ( t ) will be defined as the wandering frequency signal, or the heart rate variability signal, whose amplitude is the instantaneous shift of the heart rate from the average heart rate (frequency modulation).
The problem of recording the H R V ( t ) signal can be stated as the method by which this signal can be inferred from the quasi-periodic signal E C G ( t ) . The need to obtain a “continuous”, or “instantaneous”, H R ( t ) signal comes from the interest in analyzing very short or even ultra-short-term heart rate variations in the time domain, instead of considering cyclical variations over very long periods of time.
To describe the performance of the method described in the previous paragraph, simulated signals were initially used for which the signal used for simulating them was exactly known. It must be noted that the use of simulated signals for testing the algorithm is necessary because in this way one can compare the results of the method with the signal actually used in the simulations. For the sake of validation, the method could not be applied to real ECG signals because, in this case, the real frequency variability coded into the heart rate was not known. Once the method is validated on simulated signals, it will then be reliably used on real-life natural signals. Eventually, the method will be applied to real ECG biological signals, as described in Section 4.
For the H R V ( t ) signal, a square waveform was used, as was already shown in Figure 2, and now the performance and results of the algorithm on a mix of superimposed sinusoidal signals of different frequencies will be described.
Initially, one restates:
H R ( t ) = f 0 ¯ + H R V ( t )
then, from (3):
E C G ( t ) = s i n ( 2 π ( ( f 0 ¯ + H R V ( t ) ) d t ) )
E C G ( t ) = s i n ( 2 π f 0 ¯ t + 2 π ( H R V ( t ) d t ) )
In this simulation it will be considered that:
f 0 ¯ (Hz) or 60 f 0 ¯ (bpm) as the average heart rate, and
H R V ( t ) = f s 1 s i n ( 2 π f H R V 1 t ) + f s 2 s i n ( 2 π f H R V 2 t )
as a heart rate variability signal produced by the sum of two sinusoidal waves with two different amplitudes and two different frequencies. The following values are assumed for the various parameters:
f 0 ¯ = 1.17 Hz or 70.2 bpm, f s 1 = 0.06 and f s 2 = 0.12 as the modulation width of the two modulating signals, and f H R V 1 = 0.19 Hz and f H R V 2 = 0.32 Hz as the modulation frequencies of the two modulating signals.
The indicated parameters of the simulated ECG signal will have the following expression:
E C G ( t ) = s i n ( 2 π ( ( f 0 ¯ + f s 1 s i n ( 2 π f H R V 1 t ) + f s 2 s i n ( 2 π f H R V 2 t ) ) d t ) )
E C G ( t ) = s i n ( 2 π ( ( 1.17 + 0.06 s i n ( 2 π 0.19 t ) + 0.12 s i n ( 2 π 0.32 t ) ) d t ) )
and, solving the integral:
E C G ( t ) = s i n ( 2 π 1.17 t 0.06 2 π 0.19 c o s ( 2 π 0.19 t ) 0.12 2 π 0.32 c o s ( 2 π 0.32 t ) )
finally:
E C G ( t ) = s i n ( 7.3513 t 0.0502 c o s ( 1.1938 t ) 0.0597 c o s ( 2.0106 t ) )
Thus, the signal E C G ( t ) is a sinusoidal signal with a sinusoidal periodic variation of its frequency given by the sum of the two sinusoidal frequency modulating signals, as shown in Figure 8.
The sinusoidal carrier with an average frequency of 70.2 bpm is modulated by two sinusoidal signals at 0.19 Hz (11.4 cycles per minute) and 0.32 Hz (19.2 cycles per minute), respectively, with modulation depths of 3.6 and 7.2 cycles per minute, respectively.
The application of the algorithm on this complex simulated signal, which better represents the actual situation found in nature, provides the results depicted in Figure 9.
In an attempt to verify the quality of modulation recovery (i.e., the heart rate variability signal) from the simulated heart rate signal, the Fast Fourier Transform (FFT) of the original modulating signal and of the recovered modulation signal is calculated. The FFT was computed on the simulation, as shown in Figure 9 above, and thus on the middle and bottom tracings of Figure 9 above. The results are plotted in Figure 10.

4. Results II: Analysis of Real ECG Signals Epochs for the Appreciation of Ultra-Short-Term HRV

As the purpose of the present work was not to analyze ECG signals for HRV estimation, but rather to explain a method for doing so, the algorithm was initially tested on a few epochs of the ECG of one of the authors. No human subject was used for acquiring ECG tracings, other than the authors themselves; this is merely to show the application of the method on real tracings.
In Figure 11, the ECG of one of the authors (H.K.) was taken while he was busy playing a computer game. The idea was to acquire the fast variations in heart rate (if any) during the cognitive and emotional effort of computer gaming. Again, the authors are only interested in the ECG tracing per se, and at this stage of the research, no interest was given to the meaning of HRV signals or their correlation with the activity of the subject. Further papers will address this by using the present algorithm.
There are many different, robust, and efficient algorithms for the real-time detection of the R-wave [24,25,26,27]. In this work, a very simple software detection based on adaptive amplitude and time thresholds was programmed. The resulting peak finder and R-wave detector function were written in MATLAB as follows:
function pf = RWaveFind(y,yth,tth)
%
% RWAVEFIND Find all the peaks in the values passed on y
%   RWAVEFIND (y, yth, tth)
%   where each valid peak found must have a value above yth and
%   must be more distant than tth indexes from last found peak
%   returns a two columns matrix
%    first column are indexes where peaks were found
%    second column are amplitudes of peaks found
%
pf=[];  % start with an empty output matrix
iold=1;  % sampling index where last peak found
for i=2:(size(y,2)-1) % explore all samples on the input vector
  if (y(i-1)<y(i)) && (y(i+1)<y(i)) && (y(i)>yth)
       % test if current sample is a peak
  td=i-iold; % calculate time delay from last peak found
  iftd>tth % test if new time delay too short
    pf=[pf; i y(i)]; % add time delay to output vector
    iold=i; % keep memory of new peak found
    yth=0.5*y(i); % threshold adapting to half last
  end
 end
end
As the underlying scope of our research is that of implementing a method for assessing vagus nerve activity using the heart (heart rate) as a sort of “vagus sensor” with the final ambitious goal of recording “vagus nerve event-related activity”, the method was preliminary used on one of the well-known vagal maneuvers like the Valsalva maneuver. The fact that this research did not involve any clinical research on humans is worthy of note; the newly developed algorithm was only used on the author’s own ECG tracings (the one of the authors) to look at a real HRV signal out of the simulations, which permitted the testing of the method “in vitro”, as explained previously.
The various methods used to stimulate the vagus nerve are well-known and have been assessed clinically. They all go by the name of vagal maneuvers. The most clinically useful are the Valsalva maneuver, the carotid sinus massage, the cold-water immersion, and the eyeball pressure. The effects of these maneuvers are different, but they all provoke an increase or decrease in the heart rate, which is often mediated by a concurrent vagal stimulation.
The Valsalva maneuver was chosen as the simplest way to qualitatively test our method in the lab. It was performed by making a forced expiratory effort against a closed airway, and is considered to be a very low-risk procedure [28,29,30].
The ECG tracings were recorded using a custom-made two-channel ECG [31]. The second channel was used for recording marks for the different phases of the Valsalva maneuver, namely the exact beginning and ending times of the forceful attempt at exhalation. The ECG tracing that was obtained was processed using the algorithm, and the results are shown in Figure 12.
In Figure 12, a typical tracing is shown where the resting heart rate of the subject (one of the authors: H.K.) is 108 bpm. At the end of the forced expiratory effort, the heart rate went up to 143 bpm (or 35 bpm above the resting value). During the recovery phase, the heart rate went down to 89 bpm in just 7 s (or 54 bpm down with a negative slew rate of 8 bpm per second) before restoring the resting heart rate to 108 bpm.

5. Discussion

Most readers with a working experience in real-time heart rate detection for HRV studies or other research purposes, know very well how an instantaneous heart rate can be inferred from the common interbeat graph plotting the heart period or the inverse of it, in addition to the heart rate at each detected beat (or R-wave).
As already highlighted, the resulting instantaneous heart rate signal is not evenly sampled, and thus the interpolation, the smoothing, or both need to be used to obtain an evenly sampled heart rate.
In the previous paragraph, the importance of the new method is stressed to show how the proposed method is by itself able to detect the heart rate without resolving to measure the instantaneous beat by beat heart period, while at the same time maintaining an evenly sampled heart rate signal.
Nevertheless, as a comparison, we used the common interbeat analysis to show the different performances and to compare the results of the method presented in this paper with the more common one.
In Figure 13, the heart rate signal obtained with the presented algorithm (blue trace) is compared with the more common heart rate signal obtained with interbeat calculation (red trace), and was evenly sampled using interpolation (cubic interpolation was used, as it provides the best results). While the two reconstructed heart rate curves are similar, it must be noted that the interbeat curve showed fast oscillatory artifacts due to the interpolation of subsequent slightly different periods of the heart rate.
In addition, the reconstructed heart rate using the present algorithm preserves the shape of the heart rate variation in time, while avoiding artifacts. It should be pointed out that, because of this, the common interbeat curve is only used on very long periods of time on the ECG, as a much harder interpolation and low-pass filtering must be done to obtain an acceptable heart rate signal. In this way, the processing is only useful for analysing the heart rate on epochs of minutes, thus losing the rapid variations of the heart rate itself.
The merits of the new method lie in the possibility to reliably follow the rapid variations of the heart rate which go unnoticed with more common and still largely used methods. The relatively new interest in ultra-short-time heart rate variability [32,33] may benefit from the use of the heart rate signal detection presented here.

6. Conclusions

The proposed method for HRV signal detection has already been well-described and tested extensively on simulated signals and real ECG tracings, which produced consistent results. Discussion text has already been inserted into the various paragraphs dealing with the description of the algorithm and its applications. In this regard, particular attention should be given to the comparison of our method with other, more conventional methods of HRV detection. The superiority of this method has been demonstrated, as it completely avoids any suspicious activity of resampling or interpolation on the RR periodogram or interbeat interval tracing. In addition, a form of filtered interpolation remains to be detected in the use of low pass filtering before and after the differentiation of the cumulative sum signal.
Nevertheless, the method appears to provide a very clean HRV signal which maintains its frequency content, even at high frequencies.
The method might also be used on other frequency-modulated biomedical signals to extract a reliable modulation signal embedded in them.

Author Contributions

Literature search: all authors; Study design and conceptualization: E.M.S. and H.K.; Methodology and software: E.M.S. and A.K.R.; Validation: S.M., S.G. and A.M.; Writing and original draft preparation: E.M.S.; Review and editing: H.K. and A.K.R.; Tables and figures: E.M.S.; Supervision and project administration: E.M.S. and S.G. (Coordinator of Prevention and Rehabilitation at the Occupational Medicine Laboratory); Funding acquisition and supervision: A.M. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the Department of Biomedicine and Prevention–Occupational Medicine Section of the “Tor Vergata” University of Rome.

Informed Consent Statement

This study did not involve humans, as the only real ECG tracings were obtained from the authors themselves for the purpose of having a signal at hand for testing the algorithm. Given that the authors were not real patients or subjects in the study, consent was waived as it was not applicable.

Data Availability Statement

Data used for the simulations are available from the corresponding author.

Conflicts of Interest

The authors declare that they have no conflict of interest. The funders had no role in the design of the study; in the collection, analysis, or interpretation of data; in the writing of the manuscript, or in the decision to publish the results.

References

  1. Carson, J.R. Notes on the theory of modulation. Proc. IRE 1922, 10, 57–64. [Google Scholar] [CrossRef]
  2. Kuusela, T. Methodological Aspects of Heart Rate Variability Analysis. In Heart Rate Variability (HRV) Signal Analysis. Clinical Applications; Kamath, M.V., Watanabe, M.A., Upton, A.R.M., Eds.; CRCPress: Boca Raton, FL, USA, 2013; pp. 9–42. [Google Scholar]
  3. Yamada, M.; Ayabe, M. Treatment of Resampling Frequency and Epoch Length for RR interval in Autonomic Nervous System Analysis. In Proceedings of the 2022 IEEE 4th Global Conference on Life Science and technologies (LifeTech), Osaka, Japan, 7–9 March 2022. [Google Scholar]
  4. Cao, P.; Ye, B.; Yang, L.; Lu, F.; Fang, L.; Cai, G.; Su, Q.; Ning, G.; Pan, Q. Preprocessing Unevenly Sampled RR Interval Signals to Enhance Estimation of Heart Rate Deceleration and Acceleration Capacities in Discriminating Chronic Heart Failure Patients from Healthy Controls. Comput. Math. Methods Med. 2020, 2020, 9763826. [Google Scholar] [CrossRef]
  5. Choudhary, G.; Singh, S.N. Prediction of heart disease using machine learning algorithms. In Proceedings of the 2020 International Conference on Smart Technologies in Computing, Electrical and Electronics (ICSTCEE), Bengaluru, India, 9–10 October 2020; pp. 197–202. [Google Scholar]
  6. Zhao, L.; Li, J.; Wan, X.; Wei, S.; Liu, C. Determination of Parameters for an Entropy-Based Atrial Fibrillation Detector. Entropy 2021, 23, 1199. [Google Scholar] [CrossRef] [PubMed]
  7. VanderPlas, J.T. Understanding the Lomb-Scale Periodogram. Astrophys. J. Suppl. Ser. 2018, 236, 16. [Google Scholar] [CrossRef]
  8. Moody, G.B. Spectral Analysis of Heart Rate Without Resampling. In Proceedings of the Computers in Cardiology Conference, London, UK, 5–8 September 1993. [Google Scholar]
  9. Li, K.; Rüdiger, H.; Ziemssen, T. Spectral analysis of heart rate variability: Time window matters. Front. Neurol. 2019, 10, 545. [Google Scholar] [CrossRef] [PubMed]
  10. Laguna, P.; Moody, G.B.; Mark, R.G. Power spectral density of unevenly sampled data by least-square analysis: Performance and application to heart rate signals. IEEE Trans. Biomed. Eng. 1998, 45, 698–715. [Google Scholar] [CrossRef]
  11. Isler, Y.; Narin, A.; Ozer, M.; Perc, M. Multi-stage classification of congestive heart failure based on short-term heart rate variability. Chaos Solitons Fractals 2019, 118, 145–151. [Google Scholar] [CrossRef]
  12. Vollmer, M. A Robust, Simple and Reliable Measure of Heart Rate Variability using Relative RR Intervals. Comput. Cardiol. 2015, 42, 609–612. [Google Scholar]
  13. Sodmann, P.; Vollmer, M.; Nath, N.; Kaderali, L. A convolutional neural network for ECG annotation as the basis for classification of cardiac rhythms. Physiol. Meas. 2018, 39, 104005. [Google Scholar] [CrossRef] [PubMed]
  14. Yılmaz, M.; Kayançiçek, H.; Çekici, Y. Heart rate variability: Highlights from hidden signals. J. Integr. Cardiol. 2018, 4, 1–8. [Google Scholar] [CrossRef]
  15. Clifford, G.D. Quantifying Errors in Spectral Estimates of HRV Due to Beat Replacement and Resampling. IEEE Trans. Biomed. Eng. 2005, 52, 630–638. [Google Scholar] [CrossRef] [PubMed]
  16. Peltola, M.A. Role of editing of R–R intervals in the analysis of heart rate variability. Front. Physiol. 2012, 3, 148. [Google Scholar] [CrossRef] [PubMed]
  17. Weippert, M.; Kumar, M.; Kreuzfeld, S.; Arndt, D.; Rieger, A.; Stoll, R. Comparison of three mobile devices for measuring R–R intervals and heart rate variability: Polar S810i, Suunto t6 and an ambulatory ECG system. Eur. J. Appl. Physiol. 2010, 109, 779–786. [Google Scholar] [CrossRef]
  18. Singh, D.; Vinod, K.; Saxena, S.C. Sampling frequency of the RR interval time series for spectral analysis of heart rate variability. J. Med. Eng. Technol. 2004, 28, 263–272. [Google Scholar] [CrossRef] [PubMed]
  19. Can, Y.S.; Gokay, D.; Kılıç, D.R.; Ekiz, D.; Chalabianloo, N.; Ersoy, C. How laboratory experiments can be exploited for monitoring stress in the wild: A bridge between laboratory and daily life. Sensors 2020, 20, 838. [Google Scholar] [CrossRef] [PubMed]
  20. Koskinen, T.; Kähönen, M.; Jula, A.; Laitinen, T.; Keltikangas-Järvinen, L.; Viikari, J.; Välimäki, I.; Raitakari, O.T. Short-term heart rate variability in healthy young adults: The Cardiovascular Risk in Young Finns Study. Auton. Neurosci. 2009, 145, 81–88. [Google Scholar] [CrossRef] [PubMed]
  21. Chakravorty, P. What Is a Signal [Lecture Notes]. IEEE Signal Process. Mag. 2018, 35, 175–177. [Google Scholar] [CrossRef]
  22. Wolaver, D.H. Phase-Locked Loop Circuit Design; Prentice Hall: Hoboken, NJ, USA, 1991; p. 211. [Google Scholar]
  23. Holoborodko, P. Smooth Noise Robust Differentiators. Available online: http://www.holoborodko.com/pavel/numerical-methods/numerical-derivative/smooth-low-noise-differentiators/ (accessed on 14 December 2022).
  24. Yadav, A.; Grover, N. A Review of R Peak Detection Techniques of Electrocardiogram (ECG). J. Eng. Technol. 2017, 8, 115–134. [Google Scholar]
  25. Fierro, G.I.I.; Jorge, R.R.; Mizera-Pietraszko, J.; Martínez-García, E.A. Design and Implementation of a Data Acquisition System for R Peak Detection in Electrocardiograms. In Proceedings of the 11th International Joint Conference on Biomedical Engineering Systems and Technologies, Funchal, Portugal, 19–21 January 2018; Volume 5, pp. 715–721. [Google Scholar] [CrossRef]
  26. Sabherwal, P.; Agrawal, M.; Singh, L. Automatic detection of the R peaks in single-lead ECG signal. Circuits Syst. Signal Process. 2017, 36, 4637–4652. [Google Scholar] [CrossRef]
  27. Rexy, J.; Velmani, P.; Rajakumar, T.C. Heart beat peak detection using signal filtering in ECG data. Int. J. Adv. Technol. Eng. Explor. 2019, 6, 12–24. [Google Scholar] [CrossRef]
  28. Pstras, L.; Thomaseth, K.; Waniewski, J.; Balzani, I.; Bellavere, F. The Valsalva manoeuvre: Physiology and clinical examples. Acta Physiol. 2016, 217, 103–119. [Google Scholar] [CrossRef] [PubMed]
  29. Smith, D.L.; Fernhall, B. Advanced Cardiovascular Exercise Physiology; Human Kinetics: Singapore, 2022. [Google Scholar]
  30. Perry, B.G.; Lucas, S.J. The acute cardiorespiratory and cerebrovascular response to resistance exercise. Sport. Med.-Open 2021, 7, 1–9. [Google Scholar]
  31. Staderini, E.M.; Mugnaini, S.; Kambampati, H.; Magrini, A.; Gentili, S. Improved Multichannel Electromyograph Using Off-the-Shelf Components for Education and Research. Sensors 2022, 10, 3616. [Google Scholar] [CrossRef] [PubMed]
  32. Kim, J.W.; Seok, H.S.; Shin, H. Is Ultra-Short-Term Heart Rate Variability Valid in Non-static Conditions? Front. Physiol. 2021, 12, 596060. [Google Scholar] [CrossRef] [PubMed]
  33. Shaffer, F.; Meehan, Z.M.; Zerr, C.L. A Critical Review of Ultra-Short-Term Heart Rate Variability Norms Research. Front. Neurosci. 2020, 14, 594880. [Google Scholar] [CrossRef] [PubMed]
Figure 1. An abstract and almost black box model of the heart rate variability signal as a heart rate frequency modulator. (A) A black box model of any physiologic factor (R pulse rate modulator shown upper left) is blindly considered to impose a certain discharge frequency on the cells in the sinus node, which provide an electrical sinus node signal E S N ( t ) that propagates in the heart, and eventually will be responsible for producing an electrical signal E C G ( t ) recorded on the skin of the body. An external R-wave detector produces a signal R ( t ) that is zero at any instant of time, but when an R-wave is detected so its value is set to one (the detected R pulse). (B): The R pulse rate modulator is now black box modelled as an R pulse rate variability signal generator that produces a signal that is equal to the variation of the heart rate (over the average) at each instant of time H R V ( t ) . This signal is then summed to a constant value H R representing the average heart rate in the considered epoch to produce a signal that is equal to the heart rate at each instant of time H R ( t ) . All of the time-domain signals indicated in the figure are assumed to be continuous in time.
Figure 1. An abstract and almost black box model of the heart rate variability signal as a heart rate frequency modulator. (A) A black box model of any physiologic factor (R pulse rate modulator shown upper left) is blindly considered to impose a certain discharge frequency on the cells in the sinus node, which provide an electrical sinus node signal E S N ( t ) that propagates in the heart, and eventually will be responsible for producing an electrical signal E C G ( t ) recorded on the skin of the body. An external R-wave detector produces a signal R ( t ) that is zero at any instant of time, but when an R-wave is detected so its value is set to one (the detected R pulse). (B): The R pulse rate modulator is now black box modelled as an R pulse rate variability signal generator that produces a signal that is equal to the variation of the heart rate (over the average) at each instant of time H R V ( t ) . This signal is then summed to a constant value H R representing the average heart rate in the considered epoch to produce a signal that is equal to the heart rate at each instant of time H R ( t ) . All of the time-domain signals indicated in the figure are assumed to be continuous in time.
Bioengineering 10 00552 g001
Figure 2. Upper tracing: the simulation of an artificial instantaneous “heart rate signal”, or H R ( t ) , composed of a constant signal with an amplitude of 70.2 bpm summed to a square-wave signal having a peak-to-peak amplitude of 14.4 bpm and a frequency of 0.02 Hz; the resulting signal is a square-wave signal having an average value of 70.2 bpm alternating between 77.4 bpm and 63 bpm every 25 s. Lower trace: the H R ( t ) signal imposes the frequency of a sinusoidal signal, creating a “sinusoidal ECG” signal whose frequency is, at each instant of time, precisely that shown in the upper trace. Note that the amplitude of the H R ( t ) signal is purposely given in beats per minute (bpm), while the units of the simulated “sinusoidal ECG” signal are arbitrary. The frequency of the sinusoidal signal has been modulated by the square signal.
Figure 2. Upper tracing: the simulation of an artificial instantaneous “heart rate signal”, or H R ( t ) , composed of a constant signal with an amplitude of 70.2 bpm summed to a square-wave signal having a peak-to-peak amplitude of 14.4 bpm and a frequency of 0.02 Hz; the resulting signal is a square-wave signal having an average value of 70.2 bpm alternating between 77.4 bpm and 63 bpm every 25 s. Lower trace: the H R ( t ) signal imposes the frequency of a sinusoidal signal, creating a “sinusoidal ECG” signal whose frequency is, at each instant of time, precisely that shown in the upper trace. Note that the amplitude of the H R ( t ) signal is purposely given in beats per minute (bpm), while the units of the simulated “sinusoidal ECG” signal are arbitrary. The frequency of the sinusoidal signal has been modulated by the square signal.
Bioengineering 10 00552 g002
Figure 3. The upper trace shows a frequency-modulated signal with the square-wave modulating signal superimposed in red. Zero-crossing detection points (red) on the signal E C G ( t ) are shown in the middle trace. Bottom tracing shows the created S R ( t ) signal with a slope depending on the local instantaneous frequency of the simulated E C G ( t ) signal.
Figure 3. The upper trace shows a frequency-modulated signal with the square-wave modulating signal superimposed in red. Zero-crossing detection points (red) on the signal E C G ( t ) are shown in the middle trace. Bottom tracing shows the created S R ( t ) signal with a slope depending on the local instantaneous frequency of the simulated E C G ( t ) signal.
Bioengineering 10 00552 g003
Figure 4. Magnitude Bode plot of the moving average filter applied to the cumulative sum signal.
Figure 4. Magnitude Bode plot of the moving average filter applied to the cumulative sum signal.
Bioengineering 10 00552 g004
Figure 5. Magnitude Bode plot of Holoborodko’s differentiating filter applied to the cumulative sum signal. Please note the differentiating behavior at low frequencies thanks to the almost straight line of the graph (the output is linearly proportional to the frequency of the input signal).
Figure 5. Magnitude Bode plot of Holoborodko’s differentiating filter applied to the cumulative sum signal. Please note the differentiating behavior at low frequencies thanks to the almost straight line of the graph (the output is linearly proportional to the frequency of the input signal).
Bioengineering 10 00552 g005
Figure 6. Magnitude Bode plot of the moving average filter applied to the recovered first derivative signal (the final recovered heart rate signal).
Figure 6. Magnitude Bode plot of the moving average filter applied to the recovered first derivative signal (the final recovered heart rate signal).
Bioengineering 10 00552 g006
Figure 7. Bottom trace: the recovered heart rate signal. The 2.5-s delay of the recovered signal corresponds to the delays expected from the sequence of FIR filters.
Figure 7. Bottom trace: the recovered heart rate signal. The 2.5-s delay of the recovered signal corresponds to the delays expected from the sequence of FIR filters.
Bioengineering 10 00552 g007
Figure 8. Simulation of test signal E C G ( t ) : a sinusoidal signal (bottom trace) that is frequency modulated with the sum of two sinusoidal waves (shown separately in different colors on the upper trace), producing a final modulating signal around the average frequency of 70.2 bpm (middle trace).
Figure 8. Simulation of test signal E C G ( t ) : a sinusoidal signal (bottom trace) that is frequency modulated with the sum of two sinusoidal waves (shown separately in different colors on the upper trace), producing a final modulating signal around the average frequency of 70.2 bpm (middle trace).
Bioengineering 10 00552 g008
Figure 9. Upper trace: frequency-modulated signal and modulating signal. Bottom trace: the recovered heart rate signal. The middle trace represents the modulating waveform (cf. Figure 8).
Figure 9. Upper trace: frequency-modulated signal and modulating signal. Bottom trace: the recovered heart rate signal. The middle trace represents the modulating waveform (cf. Figure 8).
Bioengineering 10 00552 g009
Figure 10. A comparison of modulating and recovered simulation signals in the time and frequency domains. The HRV frequencies are perfectly recovered. Different amplitudes of signals in the time domain result from changing the scale from beats per second to beats per minute. Different amplitudes in the frequency domain are also due to the windowing effect (a Blackman-Harris window was used before the FFT calculation).
Figure 10. A comparison of modulating and recovered simulation signals in the time and frequency domains. The HRV frequencies are perfectly recovered. Different amplitudes of signals in the time domain result from changing the scale from beats per second to beats per minute. Different amplitudes in the frequency domain are also due to the windowing effect (a Blackman-Harris window was used before the FFT calculation).
Bioengineering 10 00552 g010
Figure 11. First test of the algorithm on a real ECG trace (top trace). In the second tracing from the top, ECG R-waves are indicated as being detected. In the third tracing, the cumulative summing signal is shown, and in the bottom trace, the filtered first derivative of the latter is plotted showing fast variations of the heart rate during the subject’s activity.
Figure 11. First test of the algorithm on a real ECG trace (top trace). In the second tracing from the top, ECG R-waves are indicated as being detected. In the third tracing, the cumulative summing signal is shown, and in the bottom trace, the filtered first derivative of the latter is plotted showing fast variations of the heart rate during the subject’s activity.
Bioengineering 10 00552 g011
Figure 12. Test of the algorithm on a real ECG trace (top trace) during the Valsalva manoeuvre.
Figure 12. Test of the algorithm on a real ECG trace (top trace) during the Valsalva manoeuvre.
Bioengineering 10 00552 g012
Figure 13. Test of the algorithm on a real ECG trace, as was shown in Figure 12. Bottom blue trace: heart rate signal obtained with the presented algorithm; bottom red trace: heart rate signal obtained with common interbeat calculation followed by even sampling with cubic interpolation. The time delay of the blue trace is due to the numerical filtering delay and is explained in the text.
Figure 13. Test of the algorithm on a real ECG trace, as was shown in Figure 12. Bottom blue trace: heart rate signal obtained with the presented algorithm; bottom red trace: heart rate signal obtained with common interbeat calculation followed by even sampling with cubic interpolation. The time delay of the blue trace is due to the numerical filtering delay and is explained in the text.
Bioengineering 10 00552 g013
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Staderini, E.M.; Kambampati, H.; Ramakrishnaiah, A.K.; Mugnaini, S.; Magrini, A.; Gentili, S. A New Algorithm for Estimating a Noiseless, Evenly Sampled, Heart Rate Modulating Signal. Bioengineering 2023, 10, 552. https://0-doi-org.brum.beds.ac.uk/10.3390/bioengineering10050552

AMA Style

Staderini EM, Kambampati H, Ramakrishnaiah AK, Mugnaini S, Magrini A, Gentili S. A New Algorithm for Estimating a Noiseless, Evenly Sampled, Heart Rate Modulating Signal. Bioengineering. 2023; 10(5):552. https://0-doi-org.brum.beds.ac.uk/10.3390/bioengineering10050552

Chicago/Turabian Style

Staderini, Enrico M., Harish Kambampati, Amith K. Ramakrishnaiah, Stefano Mugnaini, Andrea Magrini, and Sandro Gentili. 2023. "A New Algorithm for Estimating a Noiseless, Evenly Sampled, Heart Rate Modulating Signal" Bioengineering 10, no. 5: 552. https://0-doi-org.brum.beds.ac.uk/10.3390/bioengineering10050552

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop