Good afternoon. I have some heart monitor data that I am attempting to analyze. I have been given time between the peaks (in milliseconds), and have attempted to reverse-engineer a signal from this using the following code.

clear all;
%Sampling frequency
Fs = 250;
%total data time (s)
ts = xlsread('12_RR_1.xlsx','G:G');
%total data time (ms)
%total_time = xlsread('12_RR.csv.xlsx','I:I');
%Point in time where there is a max point
xn = xlsread('12_RR_1.xlsx','H:H');
xnt = size(xn);

t = 1:ts;
time = transpose(t);

for i = 1:ts
    for j = 1:xnt(1,1)
        z(i,j) = xn(j,1);
        i = i+1;
        j = j+1;

for i_2= 1:97484
    for j = 1:xnt(1,1)
   if time(i_2,1) == z(i_2,j)
       z_raw(i_2,j) = 1;
       z_raw(i_2,j) = 0;
    i_2 = i_2+1;
   j = j+1;

 peaks = sum(z_raw,2);
 Peaks = abs(peaks);
  N = length(peaks);

 title('Raw Data')

This produces a binary signal where y=1 if a peak is detected and y=0 if it is not. However, when I attempted to take the FFT of this it returns a signal with weirdly uniform noise, as shown below.

Noisy FFT

What's going on--why does a seemingly low-frequency signal have a uniform frequency response? What can I do to my original data (the time between heart impulses) to extract more meaningful information and get a more realistic FFT (high amp low freq data with small amp high freq data)

  • 1
    $\begingroup$ Ever hear the saying "garbage in, garbage out" $\endgroup$
    – user28715
    Commented Aug 28, 2017 at 18:18
  • $\begingroup$ you want to find the dominant rhythm? $\endgroup$
    – Mohammad M
    Commented Aug 28, 2017 at 19:08
  • $\begingroup$ Partially. As of right now all my team and I are wanting to see is the full range of BPMs over the course of the experiment. We are trying to figure out if we are seeing the noise from the sensors collecting the raw data or if it needs to be treated differently before feeding it into the FFT. $\endgroup$
    – TxAg
    Commented Aug 28, 2017 at 19:13
  • 4
    $\begingroup$ you are taking fft after event detection, and not from your measured signal. your event signal is like a delta train (with unequal distance) which exactly has this kind of spectrum. to find bpm find the distance between each event in second then find its inverse and multiply it by 60. $\endgroup$
    – Mohammad M
    Commented Aug 28, 2017 at 19:21

1 Answer 1


Your signal is a superposition of fairly widely spaced impulses. Each impulse by itself has a flat magnitude spectrum and the intervals between impulses are only pseudo periodic so the phase response superpositions are effectively incoherent. The problem isn't your FFT, it is your signal model.

An actual ECG is much smoother. If you expect to see a predominant frequency at around 1Hz, the signal would look like a sine wave of around 1 Hz, not a sequence of isolated spikes.

You probably really want to measure the time intervals between spikes directly in the the time domain.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.