0
votes

From the assignment:

Use the fft routine from MATLAB to find out the beats per minute (BPM) in the myecg.csv file. The sampling period for this signal is 0.00192 seconds and the signal was recorded with an attenuation of 10 on the digital scope (what do you have to do to put the signal with the proper amplitude)?

So basically I would have to get the BPM. I am able to successfully read the corresponding ECG and get the Fourier transform spectrum as well as the single sided amplitud spectrum of y(t), but I'm not sure how I can tie the info to get the BPM.

Here's an image of the signal:

enter image description here

That's my code so far:

enter image description here

1
Welcome to Stack Overflow. Please don't post images of your code, so please edit your question and put your code as text to your question. Questions from my side: (a) In the image, the xlabel is Samples, in your code it's Frequency (Hz). Are these two related? (b) Do you, in general, don't know, how to obtain the BPM from the signal, or do you "just" don't know, how to do this in Matlab? If the latter, then please tell us, how to obtain the BPM from the signal in your own words.HansHirse
And, of course, please provide your myecg.csv.HansHirse

1 Answers

0
votes

There are many ways to get the BPM, depending on your DSP knowledge. First, multiply the signal by 10 to get the "proper amplitude" as the question asks:

y_norm = y*10;
  1. Time Domain: You can calculate the time between peaks:

    mean_diff_peaks = mean( diff(find(y_norm>0.5)) );
    
    bps = 1/(mean_diff_peaks *  0.00192);
    
    bpm = bps * 60
    

    (This option is less recommended, since you need some manipulation to samples around the peaks...)

  2. Frequency Domain: You can use fft(),as you did, find the index of the peak and translate to frequency[Hz] (similar to above example)

  3. Spectrum Estimations: Use pwelch() as spectrum estimation to get more accurate results.

Goodluck!