Question

So I am doing some ECG analysis in MATLAB and so far I have detected the key features as shown in the figure below :

output

This is the ground truth : enter image description here

So how do i replot the first figure such that the x axis ranges from 0 to 10 (as shown in the second image)

I want to do this so that I can measure the time duration between the Q(the red cross) and the S (the peak at the minimum marked with a circle).

So essentially I want to 1) Calibrate 3600 samples into 10 seconds 2) Using the above scaling factor, be able to automatically calibrate any number of samples into the relevant seconds.

Thanks.

Was it helpful?

Solution

How did you plot the first figure? If you did not provide any x-axis, as in plot(ecg), the x-tick labels will be enumerated consecutevly in intervals of one. If you do know the corresponding time points t of ecg, you can use plot(t, egg);.

Since you know the sampling rate and assume consistent intervals between each data point, you can generate t yourself by t = 10.0 / 3600 * (0 : length(ecg)-1). This will create an array with length(ecg) elements starting at 0, with 10.0 per 3600 data points, for any length of ecg.

To align the horizontal axis limits more nicely than in the first plot, you can then also use xlim([0, t(end)]).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top