Compute the maximum and minimum values in the clean and noisy ECG signals.

9 views (last 30 days)
Emma Crowe
Emma Crowe on 23 Nov 2021
Commented: Rena Berman on 13 Dec 2021
Looking for help on how to find maximum and minimum points of a ECG file in matlab. Currently i have written this code but not sure if its correct. I have commented out part of it as I was trying a new method to find the datapoints. Any help would be aprreciated. Thanks
close all; clear all; opengl hardwarebasic; Fs = 200; %Saqmpling frequency is 200Hz t=[0:1:3999]/Fs; % Constructs an array t with 100 elements progressively increasing from 1/100 (0.01s) to 100/100 (1s) ecgclean=audioread('ecgclean.wav'); plot(t(400:900), ecgclean(400:900)); xlabel('Time (s)'); ylabel('Amplitude'); title('Clean ECG Signal With DC Component'); %ymax=max(ecgclean); %xmax=find(ecgclean==ymax); %xmin=find(ecgclean==min(ecgclean));
%minimum ax = gca; chart = ax.Children(1); datatip(chart,2.09,0.294);
%maximum ax2 = gca; chart2 = ax2.Children(1); datatip(chart2,3.72,0.5948);
ecg44 = audioread('ecg44.wav'); plot(t(400:900), ecg44(400:900)); xlabel('Time (s)'); ylabel('Amplitude'); title('Noisy ECG44 Signal With DC Component');
%minimum ax3 = gca; chart3 = ax3.Children(1); datatip(chart3,3.135,-0.1315);
%maximum ax4 = gca; chart4 = ax4.Children(1); datatip(chart4,3.185,0.5893);
Below are the two ECG Graphs I get;

Accepted Answer

Image Analyst
Image Analyst on 23 Nov 2021
Unfortunately you forgot to include the two wav files. But a new method, that you said you were looking for, might be bounds(). That gets you the values anyway, then you can use them to find where the values occur
[minValue, maxValue] = bounds(signal)
indexesOfMaxes = find(signal == maxValue);
indexesOfMins = find(signal == minValue);

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!