0
$\begingroup$

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.

clc;
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);
    end
        i = i+1;
        j = j+1;
end

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;
   else
       z_raw(i_2,j) = 0;
   end
    end
    i_2 = i_2+1;
   j = j+1;
end

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



 subplot(2,1,1)
 plot(t,Peaks)
 title('Raw Data')
 subplot(2,1,2)
 plot(t/Fs,fft(Peaks,ts))
 title('FFT')

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)

$\endgroup$
  • 1
    $\begingroup$ Ever hear the saying "garbage in, garbage out" $\endgroup$ – Stanley Pawlukiewicz Aug 28 '17 at 18:18
  • $\begingroup$ you want to find the dominant rhythm? $\endgroup$ – Mohammad M Aug 28 '17 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 Aug 28 '17 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 Aug 28 '17 at 19:21
1
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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