简体   繁体   中英

How to automatically calibrate axes in MATLAB?

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

输出

This is the ground truth : 在此处输入图片说明

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.

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)]) .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM